Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
turn off optimisation in Microsoft Visual Studio for TextlineProjecti…
…on::TruncateToImageBounds#pragma optimize( "", on ) fix issue 1496
- Loading branch information
9d359cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is backround from code.google.com issue 1496:
Ok, after some work I traced this to a Microsoft Visual Studio 2013 Community compiler optimization bug that was skipping operation of calls to TruncateToImageBounds() inside TextlineProjection.cpp. This allowed data access to memory outside of the image's buffer and, usually, an access violation.
This was hard to find because the problem didn't happen in debug mode (no optimization) and would cease happening if I added any kind of program logic before or after the calls to the Truncate...() method. It also only occurred in 32-bit code - no problem in 64-bit build. Also, code would work for some images alone but not when those images were being processed among multiple threads running Tesseract. An annoying problem to isolate (as are many compiler-optimization problems).
For our build (still using VS2013) we used pragmas to disable optimization for the TruncateToImageBounds() method - that seems to work based on our testing.