Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
150 Views

Problems with ippiLUT

Hello,
I have a problem with ippiLUT. Following code:
Hello, following code:
 

int values[] = { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
int levels[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
uint8_t data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
uint8_t outData[10];
IppiSize roiSize = { 10, 1 };
int specSize = 0;
int numLevels[1] = { 10 };

const int *valuesPtr[] = { values };
const int *levelsPtr[] = { levels };
ippiLUT_GetSize(IppiInterpolationType::ippNearest, ipp8u, ippC1, roiSize, numLevels, &specSize);
auto spec = (IppiLUT_Spec*)ippMalloc(specSize);
ippiLUT_Init_8u(IppiInterpolationType::ippNearest, ippC1, roiSize, valuesPtr, levelsPtr, numLevels, spec);
ippiLUT_8u_C1R(data, 10, outData, 10, roiSize, spec);
ippFree(spec);



I guess, outDatais wrong for last pixel, which has a value of 9 but should be 14. Do I use it wrongly or is this a bug?
I'm using IPP 2019.0.4.

Best regards Steffen

0 Kudos
5 Replies
Highlighted
Employee
150 Views

Hello steffenroeber,

Update uint8_t to int, and set srcStep/dstStep value from 10 to 10*sizeof(int), then you might get expected results. Let us know if have other problem.

Regards,

Ruqiu

 

0 Kudos
Highlighted
Beginner
150 Views

Hi Ruqiu,

not sure if I understood you right. Changing uint8_t data[] to int data[] is not compatible with ippiLUT_8u_C1R.

Best regards

Steffen

0 Kudos
Highlighted
Employee
150 Views

HI Steffen,

Please make sure all data type is aligned to mod in ippiLUT_<mod>.  For example, values, levels, and data. You can refer to the sample code through https://software.intel.com/en-us/ipp-dev-reference-lut

Regards,

Ruqiu

 

0 Kudos
Highlighted
New Contributor I
150 Views

Wow, bytes aligned to 8-bit bytes, that's the greatest invention in computing since the Turing machine !

Sincerely,

Adriaan van Os

 

0 Kudos
Highlighted
New Contributor I
150 Views

I have never used ippiLUT, so the following is just a guess. Maybe, ippiLUT has the same problem as ippiHistogram, see https://software.intel.com/en-us/forums/intel-integrated-performance-primitives/topic/749059

Regards,

Adriaan van Os

 

0 Kudos