- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I'm learning more and more how to use ipp, which is a great optimized library.

However, I still have sometimes some problems to understand the results that I get.

For example, I'm using ippiMulC to multiply a matrix by a negative floating constant. More precisely, here is my code:

Ipp8u src[6*2]={255,123,134,76,65,127,

128,34,78,84,121,149};

Ipp16s dst[6*2];

IppiSize size={6,2};

ippiMulC_16s_C1RSfs(src, 6, (Ipp16s) (-0.565), dst, 6, size,0);

int i,j;

for (i=0;i<2;i++)

{

for (j=0;j<6;j++)

{

printf("%d ", dst[j+i*6]);

}

printf("\\n");

}

The result is:

0 0 0 0 0 0

0 0 0 -21279 -22152 -16420

How could I get a floating result (32f uses only complex) as close as possible from the expected answer?

Should I transform -0.565 into a complex number? Should I use divC instead of mulC?

Thanks in advance!

Link Copied

2 Replies

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Please check with documentation the function parameter types. The function ippiMulC_16s_C1R takes source as a pointer to signed 16-bit integer array while you supply array of 8-bit integers (I think the piece of code you use as an example should not even compile).

Also, the result of casting -0.565 to 16-bit integer is 0 is not it? Then result of multiplication of any number with zero expected to be zero, correct?

You have to use functions which produce floating point result instead of function which produce 16-bit integer result. For example, you may try to use ippiMulC_32f_C1R function (it will require you to convert your 8-bit integer image into 32-bit floating point format with ippiConvert_8u32f_C1R function).

Regards,

Vladimir

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thanks to your advices, it works now quite well! Thank you!

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page