Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6956 Discussions

Widening conversion for vector operations

RJMNOLA
Novice
716 Views
I have an input data of int16 data that I need to convert to float32 in a widening conversion for floating point operations using either MKL or IPP. Is there a way using either of those libraries to copy the int16 inputs to a float32 array? I do not have any sample code at the moment to provide as I have not written it yet.

Generically, the computation will be to convert short[] to float[], then apply an elementwise addition to a scalar, followed by an elementwise multiplication by a scalar. I know how to do those in-place with IPP. It’s efficient widening conversion that has me at the moment. Is there perhaps an even more efficient approach than widening conversion via copy?
0 Kudos
1 Solution
Gennady_F_Intel
Moderator
673 Views

You may try the following API:

IppStatus ippsConvert_16s32f(const Ipp16s* pSrc, Ipp32f* pDst, int len);

IppStatus ippsConvert_16u32f(const Ipp16u* pSrc, Ipp32f* pDst, int len);

https://software.intel.com/content/www/us/en/develop/documentation/ipp-dev-reference/top/volume-1-signal-and-data-processing/essential-functions/conversion-functions/convert.html



View solution in original post

0 Kudos
3 Replies
MRajesh_intel
Moderator
680 Views

Hi Robert,

Thanks for reaching out to us, we are working on your issue and will get back to you soon.


Regards

Rajesh.


0 Kudos
Gennady_F_Intel
Moderator
674 Views

You may try the following API:

IppStatus ippsConvert_16s32f(const Ipp16s* pSrc, Ipp32f* pDst, int len);

IppStatus ippsConvert_16u32f(const Ipp16u* pSrc, Ipp32f* pDst, int len);

https://software.intel.com/content/www/us/en/develop/documentation/ipp-dev-reference/top/volume-1-signal-and-data-processing/essential-functions/conversion-functions/convert.html



0 Kudos
Gennady_F_Intel
Moderator
659 Views

The issue is closing. In the case of any issues or updates, you may re-open the current issue or open the one or communicate with me directly via email (Gennady.Fedorov@intel.com).



0 Kudos
Reply