Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Bug in ippimage.cpp:1387 (CIppImage::ToGray)

idana
Beginner
768 Views
Hello,
The problem is in CIppImage::ToGray(CIppImage& img, const float* coeffs)
The test below will allways return, and it should not:
if( NChannels() != 3 || NChannels() != 4 )
return -1;;
I think that AND should be used instead of OR:
if( NChannels() != 3 && NChannels() != 4 )
return -1;;
Thank you.
0 Kudos
5 Replies
Naveen_G_Intel
Employee
768 Views

Hi,

Just I verified picnic application with converting from RGB to Gray scale, it works fine, so coding logic should be correct.

Are you getting any error in the result of this function?

Thanks,

Naveen Gv

0 Kudos
Thomas_Jensen1
Beginner
768 Views
You are wrong: the code says "if not rgb24 or not rgb32 then don't do it".
0 Kudos
idana
Beginner
768 Views
I use the following IPP version:
7.0 build 205.58, [7.0.1032.205]
I used this specific function from my application and it returned -1 for color images.
The function should work if the image is rgb24 or rgb32, that is
if (!(rgb24 || rgb32))return -1;
This is equivalent to:
if (!rgb24 && !rgb32)return -1;
So the code should say"if not rgb24 AND not rgb32 then don't do it".
Thank you.
0 Kudos
Thomas_Jensen1
Beginner
768 Views
Hmm, I guess you are correct. It is too early in the morning here...

For rgb24, it would look like this:

if( 3 != 3 || 3 != 4 )
return -1;

This will always return -1 !

Naveen checked in Picnic, but I cannot find any grayscale functions in Picnic.

I also searched for ToGray() references in the source code of Picnic, but I didn't find any references except the implementation.

Naveen, can you clarify?
0 Kudos
Sergey_K_Intel
Employee
768 Views
I think that AND should be used instead of OR:
Hello,
if( NChannels() != 3 && NChannels() != 4 )
return -1;

That's true. We will fix it. Probably, there were assertions before with "assert(NChannels==3 || NChannels==4)". When substituting with "if", the expression must be turned inside out completely "NChannels!=3 && NChannels!=4"

Thank you,

Sergey

0 Kudos
Reply