Skip to content

Commit

Permalink
Merge pull request #1981 from stweil/clean
Browse files Browse the repository at this point in the history
Clean code
  • Loading branch information
zdenop authored Oct 12, 2018
2 parents 2633ba2 + d86d520 commit 30081c5
Show file tree
Hide file tree
Showing 41 changed files with 131 additions and 195 deletions.
6 changes: 3 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ SUBDIRS = src/arch src/ccutil src/viewer src/cutil src/opencl src/ccstruct
SUBDIRS += src/dict src/classify src/wordrec src/textord src/lstm
SUBDIRS += src/ccmain src/api . tessdata doc unittest

EXTRA_DIST = README.md\
aclocal.m4 config configure.ac autogen.sh \
tesseract.pc.in $(TRAINING_SUBDIR) java doc langtests unlvtests
EXTRA_DIST = README.md
EXTRA_DIST += aclocal.m4 config configure.ac autogen.sh
EXTRA_DIST += tesseract.pc.in $(TRAINING_SUBDIR) java doc langtests unlvtests

DIST_SUBDIRS = $(SUBDIRS) $(TRAINING_SUBDIR)

Expand Down
2 changes: 1 addition & 1 deletion src/api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ void TessBaseAPI::SetImage(Pix* pix) {
pixSetSpp(p1, 3);
pix = pixCopy(nullptr, p1);
pixDestroy(&p1);
}
}
thresholder_->SetImage(pix);
SetInputImage(thresholder_->GetPixRect());
}
Expand Down
14 changes: 7 additions & 7 deletions src/classify/blobclass.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/******************************************************************************
** Filename: blobclass.h
** Purpose: Interface to high level classification and training.
** Author: Dan Johnson
** History: 5/29/89, DSJ, Created.
** Filename: blobclass.h
** Purpose: Interface to high level classification and training.
** Author: Dan Johnson
**
** (c) Copyright Hewlett-Packard Company, 1988.
** (c) Copyright Hewlett-Packard Company, 1988.
** 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
Expand All @@ -15,8 +14,9 @@
** See the License for the specific language governing permissions and
** limitations under the License.
******************************************************************************/
#ifndef BLOBCLASS_H
#define BLOBCLASS_H

#ifndef BLOBCLASS_H
#define BLOBCLASS_H

/**----------------------------------------------------------------------------
Include Files and Type Defines
Expand Down
10 changes: 5 additions & 5 deletions src/classify/cutoffs.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/******************************************************************************
** Filename: cutoffs.h
** Purpose: Routines to manipulate an array of class cutoffs.
** Author: Dan Johnson
** History: Wed Feb 20 09:34:20 1991, DSJ, Created.
** Filename: cutoffs.h
** Purpose: Routines to manipulate an array of class cutoffs.
** Author: Dan Johnson
**
** (c) Copyright Hewlett-Packard Company, 1988.
** (c) Copyright Hewlett-Packard Company, 1988.
** 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
Expand All @@ -15,6 +14,7 @@
** See the License for the specific language governing permissions and
** limitations under the License.
******************************************************************************/

#ifndef CUTOFFS_H
#define CUTOFFS_H

Expand Down
15 changes: 8 additions & 7 deletions src/classify/featdefs.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/******************************************************************************
** Filename: featdefs.h
** Purpose: Definitions of currently defined feature types.
** Author: Dan Johnson
** History: Mon May 21 08:28:01 1990, DSJ, Created.
** Filename: featdefs.h
** Purpose: Definitions of currently defined feature types.
** Author: Dan Johnson
** History: Mon May 21 08:28:01 1990, DSJ, Created.
**
** (c) Copyright Hewlett-Packard Company, 1988.
** (c) Copyright Hewlett-Packard Company, 1988.
** 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
Expand All @@ -15,8 +15,9 @@
** See the License for the specific language governing permissions and
** limitations under the License.
******************************************************************************/
#ifndef FEATDEFS_H
#define FEATDEFS_H

#ifndef FEATDEFS_H
#define FEATDEFS_H

/**----------------------------------------------------------------------------
Include Files and Type Defines
Expand Down
10 changes: 5 additions & 5 deletions src/classify/float2int.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/******************************************************************************
** Filename: float2int.h
** Purpose: Routines for converting float features to int features
** Author: Dan Johnson
** History: Wed Mar 13 08:06:41 1991, DSJ, Created.
** Filename: float2int.h
** Purpose: Routines for converting float features to int features
** Author: Dan Johnson
**
** (c) Copyright Hewlett-Packard Company, 1988.
** (c) Copyright Hewlett-Packard Company, 1988.
** 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
Expand All @@ -15,6 +14,7 @@
** See the License for the specific language governing permissions and
** limitations under the License.
******************************************************************************/

#ifndef FLOAT2INT_H
#define FLOAT2INT_H

Expand Down
14 changes: 7 additions & 7 deletions src/classify/mf.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/******************************************************************************
** Filename: mf.h
** Purpose: Micro-feature interface to flexible feature extractor.
** Author: Dan Johnson
** History: Thu May 24 09:39:56 1990, DSJ, Created.
** Filename: mf.h
** Purpose: Micro-feature interface to flexible feature extractor.
** Author: Dan Johnson
**
** (c) Copyright Hewlett-Packard Company, 1988.
** (c) Copyright Hewlett-Packard Company, 1988.
** 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
Expand All @@ -15,8 +14,9 @@
** See the License for the specific language governing permissions and
** limitations under the License.
******************************************************************************/
#ifndef MF_H
#define MF_H

#ifndef MF_H
#define MF_H

/**----------------------------------------------------------------------------
Include Files and Type Defines
Expand Down
10 changes: 5 additions & 5 deletions src/classify/normmatch.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/******************************************************************************
** Filename: normmatch.h
** Purpose: Simple matcher based on character normalization features.
** Author: Dan Johnson
** History: Thu Dec 20 08:55:05 1990, DSJ, Created.
** Filename: normmatch.h
** Purpose: Simple matcher based on character normalization features.
** Author: Dan Johnson
**
** (c) Copyright Hewlett-Packard Company, 1988.
** (c) Copyright Hewlett-Packard Company, 1988.
** 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
Expand All @@ -15,6 +14,7 @@
** See the License for the specific language governing permissions and
** limitations under the License.
******************************************************************************/

#ifndef NORMMATCH_H
#define NORMMATCH_H

Expand Down
14 changes: 7 additions & 7 deletions src/classify/outfeat.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/******************************************************************************
** Filename: outfeat.h
** Purpose: Definition of outline features.
** Author: Dan Johnson
** History: 11/13/90, DSJ, Created.
** Filename: outfeat.h
** Purpose: Definition of outline features.
** Author: Dan Johnson
**
** (c) Copyright Hewlett-Packard Company, 1988.
** (c) Copyright Hewlett-Packard Company, 1988.
** 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
Expand All @@ -15,8 +14,9 @@
** See the License for the specific language governing permissions and
** limitations under the License.
******************************************************************************/
#ifndef OUTFEAT_H
#define OUTFEAT_H

#ifndef OUTFEAT_H
#define OUTFEAT_H

/**----------------------------------------------------------------------------
Include Files and Type Defines
Expand Down
11 changes: 5 additions & 6 deletions src/cutil/bitvec.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/******************************************************************************
** Filename: bitvec.c
** Purpose: Routines for manipulating bit vectors
** Author: Dan Johnson
** History: Thu Mar 15 10:37:27 1990, DSJ, Created.
** Filename: bitvec.c
** Purpose: Routines for manipulating bit vectors
** Author: Dan Johnson
**
** (c) Copyright Hewlett-Packard Company, 1988.
** (c) Copyright Hewlett-Packard Company, 1988.
** 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
Expand Down Expand Up @@ -74,7 +73,7 @@ void FreeBitVector(BIT_VECTOR BitVector) {
* hold the specified number of bits.
*
* Globals:
* - BitVectorCount number of bit vectors allocated
* - BitVectorCount number of bit vectors allocated
*
* @param NumBits number of bits in new bit vector
*
Expand Down
14 changes: 7 additions & 7 deletions src/cutil/emalloc.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/******************************************************************************
** Filename: emalloc.h
** Purpose: Definition of memory allocation routines.
** Author: Dan Johnson
** History: 4/3/89, DSJ, Created.
** Filename: emalloc.h
** Purpose: Definition of memory allocation routines.
** Author: Dan Johnson
**
** (c) Copyright Hewlett-Packard Company, 1988.
** (c) Copyright Hewlett-Packard Company, 1988.
** 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
Expand All @@ -15,8 +14,9 @@
** See the License for the specific language governing permissions and
** limitations under the License.
******************************************************************************/
#ifndef EMALLOC_H
#define EMALLOC_H

#ifndef EMALLOC_H
#define EMALLOC_H

void *Emalloc(int Size);

Expand Down
6 changes: 1 addition & 5 deletions src/dict/hyphen.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
/* -*-C-*-
********************************************************************************
* File: hyphen.cpp (Formerly hyphen.c)
* File: hyphen.cpp (Formerly hyphen.c)
* Description: Functions for maintaining information about hyphenated words.
* Author: Mark Seaman, OCR Technology
* Created: Fri Oct 16 14:37:00 1987
* Modified: Thu Mar 14 11:09:43 1991 (Mark Seaman) marks@hpgrlt
* Language: C
* Package: N/A
* Status: Reusable Software Component
*
* (c) Copyright 1987, Hewlett-Packard Company.
Expand Down
2 changes: 1 addition & 1 deletion src/opencl/openclwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2562,7 +2562,7 @@ ds_device OpenclDevice::getDeviceSelection() {
int bestDeviceIdx = -1;
for (unsigned d = 0; d < profile->numDevices; d++) {
ds_device device = profile->devices[d];
if (device.score == nullptr) continue;
if (device.score == nullptr) continue;
TessDeviceScore score = *device.score;

float time = score.time;
Expand Down
7 changes: 3 additions & 4 deletions src/textord/drawtord.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**********************************************************************
* File: drawtord.cpp (Formerly drawto.c)
* Description: Draw things to do with textord.
* Author: Ray Smith
* Created: Thu Jul 30 15:40:57 BST 1992
* Author: Ray Smith
*
* (C) Copyright 1992, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -181,13 +180,13 @@ int32_t thresholds[] //for drop out
if (occupation[line_index - min_y] < thresholds[line_index - min_y]) {
if (colour != ScrollView::BLUE) {
colour = ScrollView::BLUE;
to_win->Pen(colour);
to_win->Pen(colour);
}
}
else {
if (colour != ScrollView::WHITE) {
colour = ScrollView::WHITE;
to_win->Pen(colour);
to_win->Pen(colour);
}
}
to_win->DrawTo(fleft + occupation[line_index - min_y] / 10.0, (float) line_index);
Expand Down
3 changes: 1 addition & 2 deletions src/textord/drawtord.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**********************************************************************
* File: drawtord.h (Formerly drawto.h)
* Description: Draw things to do with textord.
* Author: Ray Smith
* Created: Thu Jul 30 15:40:57 BST 1992
* Author: Ray Smith
*
* (C) Copyright 1992, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
3 changes: 1 addition & 2 deletions src/textord/edgblob.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**********************************************************************
* File: edgblob.h (Formerly edgeloop.h)
* Description: Functions to clean up an outline before approximation.
* Author: Ray Smith
* Created: Tue Mar 26 16:56:25 GMT 1991
* Author: Ray Smith
*
* (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
3 changes: 1 addition & 2 deletions src/textord/fpchop.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**********************************************************************
* File: fpchop.h (Formerly fp_chop.h)
* Description: Code to chop fixed pitch text into character cells.
* Author: Ray Smith
* Created: Thu Sep 16 11:14:15 BST 1993
* Author: Ray Smith
*
* (C) Copyright 1993, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
3 changes: 1 addition & 2 deletions src/textord/makerow.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**********************************************************************
* File: makerow.h (Formerly makerows.h)
* Description: Code to arrange blobs into rows of text.
* Author: Ray Smith
* Created: Mon Sep 21 14:34:48 BST 1992
* Author: Ray Smith
*
* (C) Copyright 1992, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
3 changes: 1 addition & 2 deletions src/textord/oldbasel.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**********************************************************************
* File: oldbasel.h (Formerly oldbl.h)
* Description: A re-implementation of the old baseline algorithm.
* Author: Ray Smith
* Created: Wed Oct 6 09:41:48 BST 1993
* Author: Ray Smith
*
* (C) Copyright 1993, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
3 changes: 1 addition & 2 deletions src/textord/scanedg.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**********************************************************************
* File: scanedg.cpp (Formerly scanedge.c)
* Description: Raster scanning crack based edge extractor.
* Author: Ray Smith
* Created: Fri Mar 22 16:11:50 GMT 1991
* Author: Ray Smith
*
* (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
3 changes: 1 addition & 2 deletions src/textord/scanedg.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**********************************************************************
* File: scanedg.h (Formerly scanedge.h)
* Description: Raster scanning crack based edge extractor.
* Author: Ray Smith
* Created: Fri Mar 22 16:11:50 GMT 1991
* Author: Ray Smith
*
* (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
3 changes: 1 addition & 2 deletions src/textord/sortflts.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**********************************************************************
* File: sortflts.cpp (Formerly sfloats.c)
* Description: Code to maintain a sorted list of floats.
* Author: Ray Smith
* Created: Mon Oct 4 16:15:40 BST 1993
* Author: Ray Smith
*
* (C) Copyright 1993, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
3 changes: 1 addition & 2 deletions src/textord/sortflts.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**********************************************************************
* File: sortflts.h (Formerly sfloats.h)
* Description: Code to maintain a sorted list of floats.
* Author: Ray Smith
* Created: Mon Oct 4 16:15:40 BST 1993
* Author: Ray Smith
*
* (C) Copyright 1993, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
3 changes: 1 addition & 2 deletions src/textord/topitch.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**********************************************************************
* File: topitch.h (Formerly to_pitch.h)
* Description: Code to determine fixed pitchness and the pitch if fixed.
* Author: Ray Smith
* Created: Tue Aug 24 16:57:29 BST 1993
* Author: Ray Smith
*
* (C) Copyright 1993, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Loading

0 comments on commit 30081c5

Please sign in to comment.