New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue3258 #1438
Issue3258 #1438
Conversation
… to OpenCV's size_t.
{ | ||
uchar* data = (uchar*)buffer; | ||
int readed = 0; | ||
assert( count >= 0 ); |
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.
Since size_t is unsigned, this assertion became useless.
int m_block_size; | ||
int m_block_pos; | ||
size_t m_block_size; | ||
size_t m_block_pos; |
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.
This isn't quite correct, because m_block_pos
is used as an offset for fseek
, which only accepts a long
.
I also question the necessity of changing m_block_size
to size_t
, given that it's only ever set to BS_DEF_BLOCK_SIZE
, which is well within the range of int
.
…s commit. Realigned method declaration.
…e of size_t type. On the other hand all tests I made showed that the image only loads correctly with m_block_pos being of type size_t. I could not figure out if there is some other change in the code that can be done to avoid changing the the type of m_block_size.
@SpecLad I made a couple changes addressing your comments. Indeed, m_block_size has no need to be of type size_t and I did test this with my big image. However, when I changed m_block_pos back back to int for testing purposes, altough the cv::imread method did run without crashing, the image displayed misplaced lines. |
Try |
@SpecLad long works fine too. |
…image. Also, fixed another misalignment.
But seriously, I think that using long is not a good thing since its size depends on the platform we're compiling on. |
Please fix these warnings (Win x64, MSVS 2010):
|
Will check that pretty soon. |
Point is, |
@@ -211,7 +211,7 @@ void Mat::create(int d, const int* _sizes, int _type) | |||
#endif | |||
if( !allocator ) | |||
{ | |||
size_t totalsize = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount)); | |||
size_t totalsize = alignSize(((size_t)step.p[0])*size.p[0], (int)sizeof(*refcount)); |
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.
step.p[0] is already size_t, the change is not needed
@alalek I might have some problem to deal with those warnings since I do not have a Windows machine to try and fix those warnings. Is there a gcc warning that I might turn on so that I get a similar output? |
@ramiromagalhaes I think it's |
@vpisarev Could you please back to review this PR? |
@vpisarev just remind you to review :) |
@vpisarev ping |
@vpisarev Just a reminder. |
@ramiromagalhaes 10x PR! unfortunately there are build warnings: http://pullrequest.opencv.org |
as I see, there is no progress on PR, long and size_t are still used where they should not be. Actually, the images could be converted to, e.g., png format, so it's not a huge problem. Let's close this PR for now as we are cleaning the list of opened PR. @ramiromagalhaes, when you have time to address the pointed out issues, please, feel free to re-open the PR. |
Hello. We are using opencv in a commercial project and we work with huge tif files (a little over 4gb). As a workaround to this issue, we are using a different library to read the huge tif file, then we convert the data to a Mat. It would be great if this issue would be solved. |
This pach forces the coertion to size_t of certain arithmetic operations that determined the buffer sizes of a Matrix while cv::imread'ing a big PGM file I have.
Also, I changed the name of a local variable named "readed" to read. This variable simply counts the amount of bytes read from a RLByteStream.