The code in ccutil/hashfn.h was needed for some old compilers. Now that we support MSVC >= 2010 and compilers that has good support for C++11, we can drop this code.
As a result of this file removal, we now use:
std::unordered_map
std::unordered_set
std::unique_ptr
directly in the codebase with '#include' for the needed headers.
Modify also the code to use a singleton. This simplifies the code as
no locking is needed. It also slightly improves the performance because
no check whether the architecture was tested is needed.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Fix compiler warning (see below)
* Use Linux code for Mingw-w64, too
* Simplify conditional code by using X86_BUILD instead of NONX86_BUILD
* Remove unneeded call of __get_cpuid_max (already called by __get_cpuid)
* Remove unneeded #undef statement
gcc report:
lstm/weightmatrix.cpp: In static member function
'static double tesseract::WeightMatrix::DotProduct(const double*, const double*, int)':
weightmatrix.cpp:67:29: warning:
'ecx' may be used uninitialized in this function [-Wmaybe-uninitialized]
avx_available_ = (ecx & 0x10000000) != 0;
^
lstm/weightmatrix.cpp:64:30: note: 'ecx' was declared here
unsigned int eax, ebx, ecx, edx;
^
Signed-off-by: Stefan Weil <sw@weilnetz.de>
cpuid.h is only available for x86 builds. There are lots of non x86
architectures, so simply checking for PowerPC is not enough.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Builds without support for OpenMP failed with the old code. Fix this:
* Add OPENMP_CXXFLAGS for ccmain.
* Replace unconditional -fopenmp by OPENMP_CXXFLAGS for lstm.
* Always use _OPENMP for conditional compilation.
* Remove OPENMP as there is already _OPENMP.
* Include omp.h conditionally.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1366441 (#1 of 1): Division or modulo by float zero (DIVIDE_BY_ZERO)
5. divide_by_zero: In expression
static_cast<double>(char_errors) / truth_size, division by expression
truth_size which may be zero has undefined behavior.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1366443 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)
3. var_deref_model: Passing null pointer this->sub_trainer_ to
training_iteration, which dereferences it.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1366448 (#1 of 1): Big parameter passed by value (PASS_BY_VALUE)
pass_by_value: Passing parameter recoder of type
tesseract::UnicharCompress const (size 240 bytes) by value.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1366450 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
4. uninit_member: Non-static class member beam_size_ is not initialized
in this constructor nor in any functions that it calls.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1366452 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
18. uninit_member: Non-static class member input_width_ is not initialized
in this constructor nor in any functions that it calls.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
gcc report:
lstm/lstmrecognizer.cpp:608:47: error: 'isnan' was not declared in this scope
ASSERT_HOST(!isnan(output.f(t)[null_char_]));
Signed-off-by: Stefan Weil <sw@weilnetz.de>