- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
We have get the wrong results when using ippiMinMax_8u_C1R.
The wrong results apeared on at least two PCs.
On my PC the specs are:
ntel(R) Xeon(R) W-1250P
Win10 x64
VS2019 16.11.10
Ipp 8.1
Code to replicate the error is below:
IppiSize const size{320, 900};
int step_bytes{0};
Ipp8u* pImage = ippiMalloc_8u_C1(size.width, size.height, &step_bytes);
assert(pImage != nullptr);
for (int c = 0; c < size.width; c++)
{
for (int r = 0; r < size.height; r++)
{
auto sts = ippiSet_8u_C1R(125, pImage, step_bytes, size);
assert(sts == ippStsNoErr);
// set min value to zero.
Ippu8* pPixel = pImage + r * step_bytes + c;
*pPixel = 0;
// set max value to 255
pPixel = pImage + (899 - r) * step_bytes + (319 - c);
*pPixel = 255;
Ipp8u min8, max8;
sts = ippiMinMax_8u_C1R(pImage, step_bytes, size, &min8, &max8);
assert(sts == ippStsNoErr);
// Assert
assert(0 == min8); // This assert is tripped. min8 is 125 for c=2 and r=0.
assert(255 == max8);
}
}
ippiFree(pImage);
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for posting on Intel Communities.
We would like to request you to share a working reproducer, steps to reproduce (if any) and actual vs expected results so that we could try reproducing the issue at our end and will help you in assisting your issue.
Best Regards,
Shanmukh.SS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for the reply.
Code to reproduce the problem is in my original post.
A few points:
1. The problem can be reproduced with image size of 32x32 on my pc.
2. The loop order does not matter, ie the problem can be reproduced with the loops:
for (int r = 0; r < size.height; r++)
{
for (int c = 0; c < size.width; c++)
{...}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for sharing the issue description.
Code to reproduce the problem is in my original post.
>> We would like to request you to share the project file or a complete working reproducer so that we could work on your issue further as we couldn't be able to reproduce the issue with the current shared snippet.
Best Regards,
Shanmukh.SS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
Attached are the project file and test file.
The code was built and tested at Debug x64 configuration on VS2019.
Ipp version is 8.1.
Here is a minimum code to reproduce the error using test_position(0, 2);
#include "ipp.h"
#include <cassert>
void test_position(int row, int col)
{
IppiSize const size{32, 32};
int step_bytes{0};
Ipp8u* pImage = ippiMalloc_8u_C1(size.width, size.height, &step_bytes);
assert(pImage != nullptr);
// set whole image to 125
IppStatus sts = ippiSet_8u_C1R(125, pImage, step_bytes, size);
assert(sts == ippStsNoErr);
// set min value to zero.
Ipp8u* pPixel = pImage + row * step_bytes + col;
*pPixel = 0;
// set max value to 255
pPixel = pImage + (31 - row) * step_bytes + (31 - col);
*pPixel = 255;
Ipp8u min8, max8;
sts = ippiMinMax_8u_C1R(pImage, step_bytes, size, &min8, &max8);
assert(sts == ippStsNoErr);
// Assert
assert(0 == min8); // This assert is tripped. min8 is 125 for c=2 and r=0.
assert(255 == max8);
ippiFree(pImage);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for sharing the sample reproducer. We were able to compile and run the code successfully.
We have get the wrong results when using ippiMinMax_8u_C1R.
>> Could you please let us know the expected results and actual results in your case? so that it helps us in understanding the issue better?
Best Regards,
Shanmukh.SS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello and thank you for the answer.
The expected values are:
min value should be 0.
max value should be 255.
With the reproduce code attached in the previous reply (IppMinMax.7z)
The function test_position(0,2) should get the wrong results.
In that case the image is size 32x32
The pixel at row 0 and column 2 should be zero,
but the returned minimum value is 125.
The function test_iterate() gets the wrong results when c=2 and r=0 in the for loops.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We have tried executing the sample source code shared and below are our findings. (Attached the screenshots for your reference)
>>The expected values are: min value should be 0. max value should be 255.
-> Regarding test_position(0,2)
When row =0, col = 2;
pImage = 125, pPixel = 125, min8 = 0, max8 = 255 which are as per the expected values mentioned.
->Regarding test_iterate(),
pImage = 125, pPixel = 125, min8 = 0, max8 = 255 as well.
Best Regards,
Shanmukh.SS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hllo. Thank you for the reply.
>>The expected values are: min value should be 0. max value should be 255.
Exactly, that is what is expected. I do not get the same results:
For the test_position() function, with row =0, col = 2 I get:
pImage = 125
pPixel = 255 // It is set to 255 at line 56.
max8 = 255 // Ok
min8 = 125 // Wrong!
It is strange that you get pPixel = 255, and that max8 is 255 at the same time.
Regarding test_iterate(), with , c = 2 and r =0:
pImage = 125,
pPixel = 255,
min8 = 125, // wrong
max8 = 255
Here min8 and max8 are important.
pImage and pPixel are not that important.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you please try compiling and executing the source code using the latest version of ipp available and let us know if the issue persists?
Best Regards,
Shanmukh.SS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I tested with the latest IPP release (2021.6.1) and the results are correct:
min=0, and
max=255
We are not using an Ipp version higher than 8.1 because the jpeg functionality was removed and we need it.
BTW for nyone interested, the solution in our case was to replace
ippiMinMax_8u_C1R with
ippiMinMaxIndx_8u_C1R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Glad to know that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.
Best Regards,
Shanmukh.SS
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page