mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
Format code (replace ( xxx ) by (xxx))
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
63f87cac90
commit
0f3206d5fe
@ -413,9 +413,9 @@ TESS_API struct Boxa* TESS_CALL TessBaseAPIGetComponentImages(TessBaseAPI* handl
|
||||
}
|
||||
|
||||
TESS_API struct Boxa*
|
||||
TESS_CALL TessBaseAPIGetComponentImages1( TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
|
||||
const BOOL raw_image, const int raw_padding,
|
||||
struct Pixa** pixa, int** blockids, int** paraids)
|
||||
TESS_CALL TessBaseAPIGetComponentImages1(TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
|
||||
const BOOL raw_image, const int raw_padding,
|
||||
struct Pixa** pixa, int** blockids, int** paraids)
|
||||
{
|
||||
return handle->GetComponentImages(level, text_only != FALSE, raw_image, raw_padding, pixa, blockids, paraids);
|
||||
}
|
||||
@ -825,37 +825,37 @@ TESS_API ETEXT_DESC* TESS_CALL TessMonitorCreate()
|
||||
return new ETEXT_DESC();
|
||||
}
|
||||
|
||||
TESS_API void TESS_CALL TessMonitorDelete( ETEXT_DESC* monitor )
|
||||
TESS_API void TESS_CALL TessMonitorDelete(ETEXT_DESC* monitor)
|
||||
{
|
||||
delete monitor;
|
||||
}
|
||||
|
||||
TESS_API void TESS_CALL TessMonitorSetCancelFunc( ETEXT_DESC* monitor, TessCancelFunc cancelFunc )
|
||||
TESS_API void TESS_CALL TessMonitorSetCancelFunc(ETEXT_DESC* monitor, TessCancelFunc cancelFunc)
|
||||
{
|
||||
monitor->cancel = cancelFunc;
|
||||
}
|
||||
|
||||
TESS_API void TESS_CALL TessMonitorSetCancelThis( ETEXT_DESC* monitor, void* cancelThis )
|
||||
TESS_API void TESS_CALL TessMonitorSetCancelThis(ETEXT_DESC* monitor, void* cancelThis)
|
||||
{
|
||||
monitor->cancel_this = cancelThis;
|
||||
}
|
||||
|
||||
TESS_API void* TESS_CALL TessMonitorGetCancelThis( ETEXT_DESC* monitor )
|
||||
TESS_API void* TESS_CALL TessMonitorGetCancelThis(ETEXT_DESC* monitor)
|
||||
{
|
||||
return monitor->cancel_this;
|
||||
}
|
||||
|
||||
TESS_API void TESS_CALL TessMonitorSetProgressFunc( ETEXT_DESC* monitor, TessProgressFunc progressFunc )
|
||||
TESS_API void TESS_CALL TessMonitorSetProgressFunc(ETEXT_DESC* monitor, TessProgressFunc progressFunc)
|
||||
{
|
||||
monitor->progress_callback2 = progressFunc;
|
||||
}
|
||||
|
||||
TESS_API int TESS_CALL TessMonitorGetProgress( ETEXT_DESC* monitor )
|
||||
TESS_API int TESS_CALL TessMonitorGetProgress(ETEXT_DESC* monitor)
|
||||
{
|
||||
return monitor->progress;
|
||||
}
|
||||
|
||||
TESS_API void TESS_CALL TessMonitorSetDeadlineMSecs( ETEXT_DESC* monitor, int deadline )
|
||||
TESS_API void TESS_CALL TessMonitorSetDeadlineMSecs(ETEXT_DESC* monitor, int deadline)
|
||||
{
|
||||
monitor->set_deadline_msecs( deadline );
|
||||
monitor->set_deadline_msecs(deadline);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ TESS_API void TESS_CALL TessBaseAPIDelete(TessBaseAPI* handle);
|
||||
|
||||
TESS_API size_t TESS_CALL TessBaseAPIGetOpenCLDevice(TessBaseAPI* handle, void **device);
|
||||
|
||||
TESS_API void TESS_CALL TessBaseAPISetInputName( TessBaseAPI* handle, const char* name);
|
||||
TESS_API void TESS_CALL TessBaseAPISetInputName(TessBaseAPI* handle, const char* name);
|
||||
TESS_API const char* TESS_CALL TessBaseAPIGetInputName(TessBaseAPI* handle);
|
||||
|
||||
TESS_API void TESS_CALL TessBaseAPISetInputImage(TessBaseAPI* handle, struct Pix* pix);
|
||||
@ -165,13 +165,13 @@ TESS_API void TESS_CALL TessBaseAPISetOutputName(TessBaseAPI* handle, const cha
|
||||
TESS_API BOOL TESS_CALL TessBaseAPISetVariable(TessBaseAPI* handle, const char* name, const char* value);
|
||||
TESS_API BOOL TESS_CALL TessBaseAPISetDebugVariable(TessBaseAPI* handle, const char* name, const char* value);
|
||||
|
||||
TESS_API BOOL TESS_CALL TessBaseAPIGetIntVariable( const TessBaseAPI* handle, const char* name, int* value);
|
||||
TESS_API BOOL TESS_CALL TessBaseAPIGetBoolVariable( const TessBaseAPI* handle, const char* name, BOOL* value);
|
||||
TESS_API BOOL TESS_CALL TessBaseAPIGetIntVariable(const TessBaseAPI* handle, const char* name, int* value);
|
||||
TESS_API BOOL TESS_CALL TessBaseAPIGetBoolVariable(const TessBaseAPI* handle, const char* name, BOOL* value);
|
||||
TESS_API BOOL TESS_CALL TessBaseAPIGetDoubleVariable(const TessBaseAPI* handle, const char* name, double* value);
|
||||
TESS_API const char*
|
||||
TESS_CALL TessBaseAPIGetStringVariable(const TessBaseAPI* handle, const char* name);
|
||||
|
||||
TESS_API void TESS_CALL TessBaseAPIPrintVariables( const TessBaseAPI* handle, FILE* fp);
|
||||
TESS_API void TESS_CALL TessBaseAPIPrintVariables(const TessBaseAPI* handle, FILE* fp);
|
||||
TESS_API BOOL TESS_CALL TessBaseAPIPrintVariablesToFile(const TessBaseAPI* handle, const char* filename);
|
||||
|
||||
#ifdef TESS_CAPI_INCLUDE_BASEAPI
|
||||
@ -231,27 +231,27 @@ TESS_API void TESS_CALL TessBaseAPISetThresholder(TessBaseAPI* handle, TessImag
|
||||
#endif
|
||||
|
||||
TESS_API struct Pix*
|
||||
TESS_CALL TessBaseAPIGetThresholdedImage( TessBaseAPI* handle);
|
||||
TESS_CALL TessBaseAPIGetThresholdedImage(TessBaseAPI* handle);
|
||||
TESS_API struct Boxa*
|
||||
TESS_CALL TessBaseAPIGetRegions( TessBaseAPI* handle, struct Pixa** pixa);
|
||||
TESS_CALL TessBaseAPIGetRegions(TessBaseAPI* handle, struct Pixa** pixa);
|
||||
TESS_API struct Boxa*
|
||||
TESS_CALL TessBaseAPIGetTextlines( TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
|
||||
TESS_CALL TessBaseAPIGetTextlines(TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
|
||||
TESS_API struct Boxa*
|
||||
TESS_CALL TessBaseAPIGetTextlines1( TessBaseAPI* handle, const BOOL raw_image, const int raw_padding,
|
||||
struct Pixa** pixa, int** blockids, int** paraids);
|
||||
TESS_CALL TessBaseAPIGetTextlines1(TessBaseAPI* handle, const BOOL raw_image, const int raw_padding,
|
||||
struct Pixa** pixa, int** blockids, int** paraids);
|
||||
TESS_API struct Boxa*
|
||||
TESS_CALL TessBaseAPIGetStrips( TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
|
||||
TESS_CALL TessBaseAPIGetStrips(TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
|
||||
TESS_API struct Boxa*
|
||||
TESS_CALL TessBaseAPIGetWords( TessBaseAPI* handle, struct Pixa** pixa);
|
||||
TESS_CALL TessBaseAPIGetWords(TessBaseAPI* handle, struct Pixa** pixa);
|
||||
TESS_API struct Boxa*
|
||||
TESS_CALL TessBaseAPIGetConnectedComponents(TessBaseAPI* handle, struct Pixa** cc);
|
||||
TESS_API struct Boxa*
|
||||
TESS_CALL TessBaseAPIGetComponentImages( TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
|
||||
struct Pixa** pixa, int** blockids);
|
||||
TESS_CALL TessBaseAPIGetComponentImages(TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
|
||||
struct Pixa** pixa, int** blockids);
|
||||
TESS_API struct Boxa*
|
||||
TESS_CALL TessBaseAPIGetComponentImages1( TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
|
||||
const BOOL raw_image, const int raw_padding,
|
||||
struct Pixa** pixa, int** blockids, int** paraids);
|
||||
TESS_CALL TessBaseAPIGetComponentImages1(TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
|
||||
const BOOL raw_image, const int raw_padding,
|
||||
struct Pixa** pixa, int** blockids, int** paraids);
|
||||
|
||||
TESS_API int TESS_CALL TessBaseAPIGetThresholdedImageScaleFactor(const TessBaseAPI* handle);
|
||||
|
||||
@ -405,13 +405,13 @@ TESS_API float TESS_CALL TessChoiceIteratorConfidence(const TessChoiceIterator*
|
||||
/* Progress monitor */
|
||||
|
||||
TESS_API ETEXT_DESC* TESS_CALL TessMonitorCreate();
|
||||
TESS_API void TESS_CALL TessMonitorDelete( ETEXT_DESC* monitor );
|
||||
TESS_API void TESS_CALL TessMonitorSetCancelFunc( ETEXT_DESC* monitor, TessCancelFunc cancelFunc );
|
||||
TESS_API void TESS_CALL TessMonitorSetCancelThis( ETEXT_DESC* monitor, void* cancelThis );
|
||||
TESS_API void* TESS_CALL TessMonitorGetCancelThis( ETEXT_DESC* monitor );
|
||||
TESS_API void TESS_CALL TessMonitorSetProgressFunc( ETEXT_DESC* monitor, TessProgressFunc progressFunc );
|
||||
TESS_API int TESS_CALL TessMonitorGetProgress( ETEXT_DESC* monitor );
|
||||
TESS_API void TESS_CALL TessMonitorSetDeadlineMSecs( ETEXT_DESC* monitor, int deadline );
|
||||
TESS_API void TESS_CALL TessMonitorDelete(ETEXT_DESC* monitor);
|
||||
TESS_API void TESS_CALL TessMonitorSetCancelFunc(ETEXT_DESC* monitor, TessCancelFunc cancelFunc);
|
||||
TESS_API void TESS_CALL TessMonitorSetCancelThis(ETEXT_DESC* monitor, void* cancelThis);
|
||||
TESS_API void* TESS_CALL TessMonitorGetCancelThis(ETEXT_DESC* monitor);
|
||||
TESS_API void TESS_CALL TessMonitorSetProgressFunc(ETEXT_DESC* monitor, TessProgressFunc progressFunc);
|
||||
TESS_API int TESS_CALL TessMonitorGetProgress(ETEXT_DESC* monitor);
|
||||
TESS_API void TESS_CALL TessMonitorSetDeadlineMSecs(ETEXT_DESC* monitor, int deadline);
|
||||
|
||||
|
||||
#ifndef DISABLED_LEGACY_ENGINE
|
||||
|
@ -593,7 +593,7 @@ void STATS::plot(ScrollView* window, // to draw in
|
||||
window->Pen(colour);
|
||||
|
||||
for (int index = 0; index < rangemax_ - rangemin_; index++) {
|
||||
window->Rectangle( xorigin + xscale * index, yorigin,
|
||||
window->Rectangle(xorigin + xscale * index, yorigin,
|
||||
xorigin + xscale * (index + 1),
|
||||
yorigin + yscale * buckets_[index]);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class STATS {
|
||||
// between 6 and 13 = 9.5
|
||||
double median() const; // get median of samples
|
||||
// Returns the count of the given value.
|
||||
int32_t pile_count(int32_t value ) const {
|
||||
int32_t pile_count(int32_t value) const {
|
||||
if (value <= rangemin_)
|
||||
return buckets_[0];
|
||||
if (value >= rangemax_ - 1)
|
||||
|
@ -782,10 +782,10 @@ inline void CLIST_ITERATOR::add_to_end( // element to add
|
||||
Replace <parm> with "<parm>". <parm> may be an arbitrary number of tokens
|
||||
***********************************************************************/
|
||||
|
||||
#define QUOTE_IT( parm ) #parm
|
||||
#define QUOTE_IT(parm) #parm
|
||||
|
||||
/***********************************************************************
|
||||
CLISTIZE( CLASSNAME ) MACRO DEFINITION
|
||||
CLISTIZE(CLASSNAME) MACRO DEFINITION
|
||||
======================================
|
||||
|
||||
CLASSNAME is assumed to be the name of a class to be used in a CONS list
|
||||
@ -810,7 +810,7 @@ The ...IZE macros define the code use in .c files
|
||||
***********************************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
CLISTIZEH( CLASSNAME ) MACRO
|
||||
CLISTIZEH(CLASSNAME) MACRO
|
||||
|
||||
CLISTIZEH is a concatenation of 3 fragments CLISTIZEH_A, CLISTIZEH_B and
|
||||
CLISTIZEH_C.
|
||||
@ -907,7 +907,7 @@ CLISTIZEH_C.
|
||||
CLISTIZEH_C(CLASSNAME)
|
||||
|
||||
/***********************************************************************
|
||||
CLISTIZE( CLASSNAME ) MACRO
|
||||
CLISTIZE(CLASSNAME) MACRO
|
||||
***********************************************************************/
|
||||
|
||||
#define CLISTIZE(CLASSNAME) \
|
||||
|
@ -826,10 +826,10 @@ inline void ELIST_ITERATOR::add_to_end( // element to add
|
||||
Replace <parm> with "<parm>". <parm> may be an arbitrary number of tokens
|
||||
***********************************************************************/
|
||||
|
||||
#define QUOTE_IT( parm ) #parm
|
||||
#define QUOTE_IT(parm) #parm
|
||||
|
||||
/***********************************************************************
|
||||
ELISTIZE( CLASSNAME ) MACRO
|
||||
ELISTIZE(CLASSNAME) MACRO
|
||||
============================
|
||||
|
||||
CLASSNAME is assumed to be the name of a class which has a baseclass of
|
||||
@ -852,7 +852,7 @@ The ...IZE macros define the code use in .c files
|
||||
***********************************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
ELISTIZEH( CLASSNAME ) MACRO
|
||||
ELISTIZEH(CLASSNAME) MACRO
|
||||
|
||||
ELISTIZEH is a concatenation of 3 fragments ELISTIZEH_A, ELISTIZEH_B and
|
||||
ELISTIZEH_C.
|
||||
@ -893,10 +893,10 @@ private: \
|
||||
DONT_CONSTRUCT_LIST_BY_COPY.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, nullptr);\
|
||||
} \
|
||||
void operator=(const CLASSNAME##_LIST&) { \
|
||||
DONT_ASSIGN_LISTS.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, nullptr ); \
|
||||
DONT_ASSIGN_LISTS.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, nullptr); \
|
||||
} \
|
||||
|
||||
#define ELISTIZEH_C( CLASSNAME ) \
|
||||
#define ELISTIZEH_C(CLASSNAME) \
|
||||
}; \
|
||||
\
|
||||
\
|
||||
@ -945,17 +945,17 @@ class DLLSYM CLASSNAME##_IT : public ELIST_ITERATOR { \
|
||||
} \
|
||||
};
|
||||
|
||||
#define ELISTIZEH( CLASSNAME ) \
|
||||
#define ELISTIZEH(CLASSNAME) \
|
||||
\
|
||||
ELISTIZEH_A( CLASSNAME ) \
|
||||
ELISTIZEH_A(CLASSNAME) \
|
||||
\
|
||||
ELISTIZEH_B( CLASSNAME ) \
|
||||
ELISTIZEH_B(CLASSNAME) \
|
||||
\
|
||||
ELISTIZEH_C( CLASSNAME )
|
||||
ELISTIZEH_C(CLASSNAME)
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
ELISTIZE( CLASSNAME ) MACRO
|
||||
ELISTIZE(CLASSNAME) MACRO
|
||||
***********************************************************************/
|
||||
|
||||
#define ELISTIZE(CLASSNAME) \
|
||||
|
@ -102,7 +102,7 @@ int32_t ELIST2::length() const { // count elements
|
||||
*
|
||||
* Sort elements on list
|
||||
* NB If you don't like the const declarations in the comparator, coerce yours:
|
||||
* ( int (*)(const void *, const void *)
|
||||
* (int (*)(const void *, const void *)
|
||||
**********************************************************************/
|
||||
|
||||
void
|
||||
|
@ -824,10 +824,10 @@ inline void ELIST2_ITERATOR::add_to_end( // element to add
|
||||
Replace <parm> with "<parm>". <parm> may be an arbitrary number of tokens
|
||||
***********************************************************************/
|
||||
|
||||
#define QUOTE_IT( parm ) #parm
|
||||
#define QUOTE_IT(parm) #parm
|
||||
|
||||
/***********************************************************************
|
||||
ELIST2IZE( CLASSNAME ) MACRO DEFINITION
|
||||
ELIST2IZE(CLASSNAME) MACRO DEFINITION
|
||||
======================================
|
||||
|
||||
CLASSNAME is assumed to be the name of a class which has a baseclass of
|
||||
@ -851,7 +851,7 @@ The ...IZE macros define the code use in .c files
|
||||
***********************************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
ELIST2IZEH( CLASSNAME ) MACRO
|
||||
ELIST2IZEH(CLASSNAME) MACRO
|
||||
|
||||
ELIST2IZEH is a concatenation of 3 fragments ELIST2IZEH_A, ELIST2IZEH_B and
|
||||
ELIST2IZEH_C.
|
||||
@ -955,7 +955,7 @@ ELIST2IZEH_C.
|
||||
ELIST2IZEH_C(CLASSNAME)
|
||||
|
||||
/***********************************************************************
|
||||
ELIST2IZE( CLASSNAME ) MACRO
|
||||
ELIST2IZE(CLASSNAME) MACRO
|
||||
***********************************************************************/
|
||||
|
||||
#define ELIST2IZE(CLASSNAME) \
|
||||
|
@ -142,7 +142,7 @@ class ETEXT_DESC { // output header
|
||||
err_code(0),
|
||||
cancel(nullptr),
|
||||
progress_callback(nullptr),
|
||||
progress_callback2( &default_progress_func ),
|
||||
progress_callback2(&default_progress_func),
|
||||
cancel_this(nullptr) {
|
||||
end_time.tv_sec = 0;
|
||||
end_time.tv_usec = 0;
|
||||
@ -173,7 +173,7 @@ private:
|
||||
static bool default_progress_func(ETEXT_DESC* ths, int left, int right, int top,
|
||||
int bottom)
|
||||
{
|
||||
if ( ths->progress_callback ) {
|
||||
if (ths->progress_callback) {
|
||||
return (*(ths->progress_callback))(ths->progress, left, right, top, bottom);
|
||||
}
|
||||
return true;
|
||||
|
@ -360,7 +360,7 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) {
|
||||
|
||||
scan_int:
|
||||
q = SkipSpace(stream);
|
||||
if ( q <= 0 ) {
|
||||
if (q <= 0) {
|
||||
bail = BAIL_EOF;
|
||||
break;
|
||||
}
|
||||
@ -471,7 +471,7 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) {
|
||||
break;
|
||||
|
||||
case '%': // %% sequence
|
||||
if (fgetc(stream) != '%' )
|
||||
if (fgetc(stream) != '%')
|
||||
bail = BAIL_ERR;
|
||||
break;
|
||||
|
||||
|
@ -34,7 +34,7 @@ class STRING;
|
||||
Replace <parm> with "<parm>". <parm> may be an arbitrary number of tokens
|
||||
***********************************************************************/
|
||||
|
||||
#define QUOTE_IT( parm ) #parm
|
||||
#define QUOTE_IT(parm) #parm
|
||||
|
||||
namespace tesseract {
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -204,7 +204,7 @@ typedef double (*SOLVEFUNC) (CHISTRUCT *, double);
|
||||
|
||||
#define Odd(N) ((N)%2)
|
||||
#define Mirror(N,R) ((R) - (N) - 1)
|
||||
#define Abs(N) ( ( (N) < 0 ) ? ( -(N) ) : (N) )
|
||||
#define Abs(N) (((N) < 0) ? (-(N)) : (N))
|
||||
|
||||
//--------------Global Data Definitions and Declarations----------------------
|
||||
/** the following variables describe a discrete normal distribution
|
||||
@ -477,7 +477,7 @@ SAMPLE* MakeSample(CLUSTERER * Clusterer, const float* Feature,
|
||||
Clusterer->NumChar = CharID + 1;
|
||||
|
||||
// execute hook for monitoring clustering operation
|
||||
// (*SampleCreationHook)( Sample );
|
||||
// (*SampleCreationHook)(Sample);
|
||||
|
||||
return (Sample);
|
||||
} // MakeSample
|
||||
@ -2233,7 +2233,7 @@ CHISTRUCT *NewChiStruct(uint16_t DegreesOfFreedom, double Alpha) {
|
||||
|
||||
/**
|
||||
* This routine attempts to find an x value at which Function
|
||||
* goes to zero (i.e. a root of the function ). It will only
|
||||
* goes to zero (i.e. a root of the function). It will only
|
||||
* work correctly if a solution actually exists and there
|
||||
* are no extrema between the solution and the InitialGuess.
|
||||
* The algorithms used are extremely primitive.
|
||||
@ -2242,7 +2242,7 @@ CHISTRUCT *NewChiStruct(uint16_t DegreesOfFreedom, double Alpha) {
|
||||
* @param FunctionParams arbitrary data to pass to function
|
||||
* @param InitialGuess point to start solution search at
|
||||
* @param Accuracy maximum allowed error
|
||||
* @return Solution of function ( x for which f(x) = 0 ).
|
||||
* @return Solution of function (x for which f(x) = 0).
|
||||
*/
|
||||
double
|
||||
Solve (SOLVEFUNC Function,
|
||||
@ -2296,8 +2296,8 @@ void *FunctionParams, double InitialGuess, double Accuracy)
|
||||
* from 0 to x, minus the desired area under the curve. The
|
||||
* number of degrees of freedom of the chi curve is specified
|
||||
* in the ChiParams structure. The desired area is also
|
||||
* specified in the ChiParams structure as Alpha ( or 1 minus
|
||||
* the desired area ). This routine is intended to be passed
|
||||
* specified in the ChiParams structure as Alpha (or 1 minus
|
||||
* the desired area). This routine is intended to be passed
|
||||
* to the Solve() function to find the value of chi-squared
|
||||
* which will yield a desired area under the right tail of
|
||||
* the chi density curve. The function will only work for
|
||||
|
@ -354,7 +354,7 @@ void WriteProtoList(FILE* File, uint16_t N, PARAM_DESC* ParamDesc,
|
||||
/* write prototypes */
|
||||
iterate(ProtoList)
|
||||
{
|
||||
Proto = (PROTOTYPE *) first_node ( ProtoList );
|
||||
Proto = (PROTOTYPE *) first_node (ProtoList);
|
||||
if ((Proto->Significant && WriteSigProtos) ||
|
||||
(!Proto->Significant && WriteInsigProtos))
|
||||
WritePrototype(File, N, Proto);
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <cmath>
|
||||
|
||||
#define Magnitude(X) ((X) < 0 ? -(X) : (X))
|
||||
#define NodeFound(N,K,D) (( (N)->Key == (K) ) && ( (N)->Data == (D) ))
|
||||
#define NodeFound(N,K,D) (((N)->Key == (K)) && ((N)->Data == (D)))
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
Global Data Definitions and Declarations
|
||||
|
@ -45,7 +45,7 @@ typedef float *MICROFEATURE;
|
||||
----------------------------------------------------------------------------**/
|
||||
|
||||
/* macros for accessing micro-feature lists */
|
||||
#define NextFeatureOf(L) ( (MICROFEATURE) first_node ( L ) )
|
||||
#define NextFeatureOf(L) ((MICROFEATURE)first_node(L))
|
||||
|
||||
/**----------------------------------------------------------------------------
|
||||
Public Function Prototypes
|
||||
|
@ -249,7 +249,7 @@ KERNEL(
|
||||
else
|
||||
lastword = *(sword + row*wpl + eiter);
|
||||
|
||||
for ( i = 1; i < nwords; i++)
|
||||
for (i = 1; i < nwords; i++)
|
||||
{
|
||||
//Gets LHS words
|
||||
if ((siter + i) < 0)
|
||||
@ -604,7 +604,7 @@ KERNEL(
|
||||
lastword = *(sword + row*wpl + eiter);
|
||||
|
||||
|
||||
for ( i = 1; i < nwords; i++)
|
||||
for (i = 1; i < nwords; i++)
|
||||
{
|
||||
//Gets LHS words
|
||||
if ((siter + i) < 0)
|
||||
@ -809,17 +809,17 @@ void kernel_HistogramRectAllChannels(
|
||||
int threadOffset = get_global_id(0)%HIST_REDUNDANCY;
|
||||
|
||||
// for each pixel/channel, accumulate in global memory
|
||||
for ( uint pc = get_global_id(0); pc < numPixels*NUM_CHANNELS/HR_UNROLL_SIZE; pc += get_global_size(0) ) {
|
||||
for (uint pc = get_global_id(0); pc < numPixels*NUM_CHANNELS/HR_UNROLL_SIZE; pc += get_global_size(0)) {
|
||||
pixels = data[pc];
|
||||
// channel bin thread
|
||||
atomic_inc( &histBuffer[ 0*HIST_SIZE*HIST_REDUNDANCY + pixels.s0*HIST_REDUNDANCY + threadOffset ]); // ch0
|
||||
atomic_inc( &histBuffer[ 0*HIST_SIZE*HIST_REDUNDANCY + pixels.s4*HIST_REDUNDANCY + threadOffset ]); // ch0
|
||||
atomic_inc( &histBuffer[ 1*HIST_SIZE*HIST_REDUNDANCY + pixels.s1*HIST_REDUNDANCY + threadOffset ]); // ch1
|
||||
atomic_inc( &histBuffer[ 1*HIST_SIZE*HIST_REDUNDANCY + pixels.s5*HIST_REDUNDANCY + threadOffset ]); // ch1
|
||||
atomic_inc( &histBuffer[ 2*HIST_SIZE*HIST_REDUNDANCY + pixels.s2*HIST_REDUNDANCY + threadOffset ]); // ch2
|
||||
atomic_inc( &histBuffer[ 2*HIST_SIZE*HIST_REDUNDANCY + pixels.s6*HIST_REDUNDANCY + threadOffset ]); // ch2
|
||||
atomic_inc( &histBuffer[ 3*HIST_SIZE*HIST_REDUNDANCY + pixels.s3*HIST_REDUNDANCY + threadOffset ]); // ch3
|
||||
atomic_inc( &histBuffer[ 3*HIST_SIZE*HIST_REDUNDANCY + pixels.s7*HIST_REDUNDANCY + threadOffset ]); // ch3
|
||||
atomic_inc(&histBuffer[0*HIST_SIZE*HIST_REDUNDANCY + pixels.s0*HIST_REDUNDANCY + threadOffset]); // ch0
|
||||
atomic_inc(&histBuffer[0*HIST_SIZE*HIST_REDUNDANCY + pixels.s4*HIST_REDUNDANCY + threadOffset]); // ch0
|
||||
atomic_inc(&histBuffer[1*HIST_SIZE*HIST_REDUNDANCY + pixels.s1*HIST_REDUNDANCY + threadOffset]); // ch1
|
||||
atomic_inc(&histBuffer[1*HIST_SIZE*HIST_REDUNDANCY + pixels.s5*HIST_REDUNDANCY + threadOffset]); // ch1
|
||||
atomic_inc(&histBuffer[2*HIST_SIZE*HIST_REDUNDANCY + pixels.s2*HIST_REDUNDANCY + threadOffset]); // ch2
|
||||
atomic_inc(&histBuffer[2*HIST_SIZE*HIST_REDUNDANCY + pixels.s6*HIST_REDUNDANCY + threadOffset]); // ch2
|
||||
atomic_inc(&histBuffer[3*HIST_SIZE*HIST_REDUNDANCY + pixels.s3*HIST_REDUNDANCY + threadOffset]); // ch3
|
||||
atomic_inc(&histBuffer[3*HIST_SIZE*HIST_REDUNDANCY + pixels.s7*HIST_REDUNDANCY + threadOffset]); // ch3
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -838,17 +838,17 @@ void kernel_HistogramRectOneChannel(
|
||||
int threadOffset = get_global_id(0)%HIST_REDUNDANCY;
|
||||
|
||||
// for each pixel/channel, accumulate in global memory
|
||||
for ( uint pc = get_global_id(0); pc < numPixels/HR_UNROLL_SIZE; pc += get_global_size(0) ) {
|
||||
for (uint pc = get_global_id(0); pc < numPixels/HR_UNROLL_SIZE; pc += get_global_size(0)) {
|
||||
pixels = data[pc];
|
||||
// bin thread
|
||||
atomic_inc( &histBuffer[ pixels.s0*HIST_REDUNDANCY + threadOffset ]);
|
||||
atomic_inc( &histBuffer[ pixels.s1*HIST_REDUNDANCY + threadOffset ]);
|
||||
atomic_inc( &histBuffer[ pixels.s2*HIST_REDUNDANCY + threadOffset ]);
|
||||
atomic_inc( &histBuffer[ pixels.s3*HIST_REDUNDANCY + threadOffset ]);
|
||||
atomic_inc( &histBuffer[ pixels.s4*HIST_REDUNDANCY + threadOffset ]);
|
||||
atomic_inc( &histBuffer[ pixels.s5*HIST_REDUNDANCY + threadOffset ]);
|
||||
atomic_inc( &histBuffer[ pixels.s6*HIST_REDUNDANCY + threadOffset ]);
|
||||
atomic_inc( &histBuffer[ pixels.s7*HIST_REDUNDANCY + threadOffset ]);
|
||||
atomic_inc(&histBuffer[pixels.s0*HIST_REDUNDANCY + threadOffset]);
|
||||
atomic_inc(&histBuffer[pixels.s1*HIST_REDUNDANCY + threadOffset]);
|
||||
atomic_inc(&histBuffer[pixels.s2*HIST_REDUNDANCY + threadOffset]);
|
||||
atomic_inc(&histBuffer[pixels.s3*HIST_REDUNDANCY + threadOffset]);
|
||||
atomic_inc(&histBuffer[pixels.s4*HIST_REDUNDANCY + threadOffset]);
|
||||
atomic_inc(&histBuffer[pixels.s5*HIST_REDUNDANCY + threadOffset]);
|
||||
atomic_inc(&histBuffer[pixels.s6*HIST_REDUNDANCY + threadOffset]);
|
||||
atomic_inc(&histBuffer[pixels.s7*HIST_REDUNDANCY + threadOffset]);
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -870,7 +870,7 @@ void kernel_HistogramRectAllChannelsReduction(
|
||||
int value = 0;
|
||||
|
||||
// accumulate in register
|
||||
for ( uint i = get_local_id(0); i < HIST_REDUNDANCY; i+=GROUP_SIZE) {
|
||||
for (uint i = get_local_id(0); i < HIST_REDUNDANCY; i+=GROUP_SIZE) {
|
||||
value += histBuffer[ channel*HIST_SIZE*HIST_REDUNDANCY+bin*HIST_REDUNDANCY+i];
|
||||
}
|
||||
|
||||
@ -912,7 +912,7 @@ void kernel_HistogramRectOneChannelReduction(
|
||||
int value = 0;
|
||||
|
||||
// accumulate in register
|
||||
for ( int i = get_local_id(0); i < HIST_REDUNDANCY; i+=GROUP_SIZE) {
|
||||
for (int i = get_local_id(0); i < HIST_REDUNDANCY; i+=GROUP_SIZE) {
|
||||
value += histBuffer[ bin*HIST_REDUNDANCY+i];
|
||||
}
|
||||
|
||||
@ -966,16 +966,16 @@ void kernel_ThresholdRectToPix(
|
||||
// declare variables
|
||||
int pThresholds[NUM_CHANNELS];
|
||||
int pHi_Values[NUM_CHANNELS];
|
||||
for ( int i = 0; i < NUM_CHANNELS; i++) {
|
||||
for (int i = 0; i < NUM_CHANNELS; i++) {
|
||||
pThresholds[i] = thresholds[i];
|
||||
pHi_Values[i] = hi_values[i];
|
||||
}
|
||||
|
||||
// for each word (32 pixels) in output image
|
||||
for ( uint w = get_global_id(0); w < wpl*height; w += get_global_size(0) ) {
|
||||
for (uint w = get_global_id(0); w < wpl*height; w += get_global_size(0)) {
|
||||
unsigned int word = 0; // all bits start at zero
|
||||
// for each burst in word
|
||||
for ( int b = 0; b < BURSTS_PER_WORD; b++) {
|
||||
for (int b = 0; b < BURSTS_PER_WORD; b++) {
|
||||
// load burst
|
||||
charVec pixels;
|
||||
int offset = (w / wpl) * width;
|
||||
@ -986,8 +986,8 @@ void kernel_ThresholdRectToPix(
|
||||
pixels.v[i] = imageData[offset + i];
|
||||
|
||||
// for each pixel in burst
|
||||
for ( int p = 0; p < PIXELS_PER_BURST; p++) {
|
||||
for ( int c = 0; c < NUM_CHANNELS; c++) {
|
||||
for (int p = 0; p < PIXELS_PER_BURST; p++) {
|
||||
for (int c = 0; c < NUM_CHANNELS; c++) {
|
||||
unsigned char pixChan = pixels.s[p*NUM_CHANNELS + c];
|
||||
if (pHi_Values[c] >= 0 && (pixChan > pThresholds[c]) == (pHi_Values[c] == 0)) {
|
||||
const uint kTopBit = 0x80000000;
|
||||
@ -1023,17 +1023,17 @@ void kernel_ThresholdRectToPix_OneChan(
|
||||
// declare variables
|
||||
int pThresholds[1];
|
||||
int pHi_Values[1];
|
||||
for ( int i = 0; i < 1; i++) {
|
||||
for (int i = 0; i < 1; i++) {
|
||||
pThresholds[i] = thresholds[i];
|
||||
pHi_Values[i] = hi_values[i];
|
||||
}
|
||||
|
||||
// for each word (32 pixels) in output image
|
||||
for ( uint w = get_global_id(0); w < wpl*height; w += get_global_size(0) ) {
|
||||
for (uint w = get_global_id(0); w < wpl*height; w += get_global_size(0)) {
|
||||
unsigned int word = 0; // all bits start at zero
|
||||
|
||||
// for each burst in word
|
||||
for ( int b = 0; b < BURSTS_PER_WORD; b++) {
|
||||
for (int b = 0; b < BURSTS_PER_WORD; b++) {
|
||||
|
||||
// load burst
|
||||
charVec1 pixels;
|
||||
@ -1044,7 +1044,7 @@ void kernel_ThresholdRectToPix_OneChan(
|
||||
+ 0 ];
|
||||
|
||||
// for each pixel in burst
|
||||
for ( int p = 0; p < PIXELS_PER_BURST; p++) {
|
||||
for (int p = 0; p < PIXELS_PER_BURST; p++) {
|
||||
|
||||
//int littleEndianIdx = p ^ 3;
|
||||
//int bigEndianIdx = p;
|
||||
|
@ -78,7 +78,7 @@ int16_t band_min,
|
||||
int16_t range_max,
|
||||
int16_t range_min]
|
||||
{
|
||||
if ( (range_min >= band_min) && (range_max < band_max) )
|
||||
if ((range_min >= band_min) && (range_max < band_max))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -97,7 +97,7 @@ int16_t band_min,
|
||||
int16_t range_max,
|
||||
int16_t range_min]
|
||||
{
|
||||
if ( (range_max >= band_min) && (range_min < band_max) )
|
||||
if ((range_max >= band_min) && (range_min < band_max))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
@ -131,7 +131,7 @@ void ColPartitionSet::ImproveColumnCandidate(WidthCallback* cb,
|
||||
int col_box_left = col_part->BoxLeftKey();
|
||||
bool tab_width_ok = cb->Run(part->KeyWidth(col_left, part_right));
|
||||
bool box_width_ok = cb->Run(part->KeyWidth(col_box_left, part_right));
|
||||
if (tab_width_ok || (!part_width_ok )) {
|
||||
if (tab_width_ok || (!part_width_ok)) {
|
||||
// The tab is leaving the good column metric at least as good as
|
||||
// it was before, so use the tab.
|
||||
part->CopyLeftTab(*col_part, false);
|
||||
@ -152,7 +152,7 @@ void ColPartitionSet::ImproveColumnCandidate(WidthCallback* cb,
|
||||
int col_box_right = col_part->BoxRightKey();
|
||||
bool tab_width_ok = cb->Run(part->KeyWidth(part_left, col_right));
|
||||
bool box_width_ok = cb->Run(part->KeyWidth(part_left, col_box_right));
|
||||
if (tab_width_ok || (!part_width_ok )) {
|
||||
if (tab_width_ok || (!part_width_ok)) {
|
||||
// The tab is leaving the good column metric at least as good as
|
||||
// it was before, so use the tab.
|
||||
part->CopyRightTab(*col_part, false);
|
||||
|
@ -209,7 +209,7 @@ int TabFind::GutterWidth(int bottom_y, int top_y, const TabVector& v,
|
||||
void TabFind::GutterWidthAndNeighbourGap(int tab_x, int mean_height,
|
||||
int max_gutter, bool left,
|
||||
BLOBNBOX* bbox, int* gutter_width,
|
||||
int* neighbour_gap ) {
|
||||
int* neighbour_gap) {
|
||||
const TBOX& box = bbox->bounding_box();
|
||||
// The gutter and internal sides of the box.
|
||||
int gutter_x = left ? box.left() : box.right();
|
||||
|
@ -808,7 +808,7 @@ int16_t Textord::stats_count_under(STATS *stats, int16_t threshold) {
|
||||
* (I.e. reasonably large space and kn:sp ratio)
|
||||
* && > 3/4 # gaps < kn + (sp - kn)/3
|
||||
* (I.e. most gaps are well away from space estimate)
|
||||
* && a gap of max( 3, (sp - kn)/3 ) empty histogram positions is found
|
||||
* && a gap of max(3, (sp - kn) / 3) empty histogram positions is found
|
||||
* somewhere in the histogram between kn and sp
|
||||
* THEN set the threshold and fuzzy limits to this gap - ie NO fuzzies
|
||||
* NO!!!!! the bristol line has "11" with a gap of 12 between the 1's!!!
|
||||
@ -836,7 +836,7 @@ void Textord::improve_row_threshold(TO_ROW *row, STATS *all_gap_stats) {
|
||||
tprintf (" 1");
|
||||
/*
|
||||
Look for the first region of all 0's in the histogram which is wider than
|
||||
max( 3, (sp - kn)/3 ) and starts between kn and sp. If found, and current
|
||||
max(3, (sp - kn) / 3) and starts between kn and sp. If found, and current
|
||||
threshold is not within it, move the threshold so that is is just inside it.
|
||||
*/
|
||||
reqd_zero_width = (int16_t) floor ((sp - kn) / 3 + 0.5);
|
||||
@ -1493,9 +1493,9 @@ bool Textord::make_a_word_break(
|
||||
|
||||
/* Heuristics to turn dubious kerns to spaces */
|
||||
/* TRIED THIS BUT IT MADE THINGS WORSE
|
||||
if ( prev_gap == INT16_MAX )
|
||||
if (prev_gap == INT16_MAX)
|
||||
prev_gap = 0; // start of row
|
||||
if ( next_gap == INT16_MAX )
|
||||
if (next_gap == INT16_MAX)
|
||||
next_gap = 0; // end of row
|
||||
*/
|
||||
if ((prev_blob_box.width () > 0) &&
|
||||
|
@ -251,9 +251,9 @@ static void WriteProtos(FILE* File, uint16_t N, LIST ProtoList,
|
||||
// write prototypes
|
||||
iterate(ProtoList)
|
||||
{
|
||||
Proto = (PROTOTYPE *) first_node ( ProtoList );
|
||||
if (( Proto->Significant && WriteSigProtos ) ||
|
||||
( ! Proto->Significant && WriteInsigProtos ) )
|
||||
WritePrototype( File, N, Proto );
|
||||
Proto = (PROTOTYPE*)first_node(ProtoList);
|
||||
if ((Proto->Significant && WriteSigProtos) ||
|
||||
(! Proto->Significant && WriteInsigProtos))
|
||||
WritePrototype(File, N, Proto);
|
||||
}
|
||||
} // WriteProtos
|
||||
|
@ -851,11 +851,9 @@ void AddToNormProtosList(
|
||||
int NumberOfProtos(LIST ProtoList, bool CountSigProtos,
|
||||
bool CountInsigProtos) {
|
||||
int N = 0;
|
||||
PROTOTYPE* Proto;
|
||||
|
||||
iterate(ProtoList)
|
||||
{
|
||||
Proto = (PROTOTYPE *) first_node ( ProtoList );
|
||||
PROTOTYPE* Proto = (PROTOTYPE*)first_node(ProtoList);
|
||||
if ((Proto->Significant && CountSigProtos) ||
|
||||
(!Proto->Significant && CountInsigProtos))
|
||||
N++;
|
||||
|
Loading…
Reference in New Issue
Block a user