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

## Counvert 16-bit signed to unsigned

Beginner
1,078 Views

Hello,

We use 3rd party component, which provides output as 16-bit signed integers. Later on we have to scale this image. IPP supports just unsigned data in ippiResize function so I have to convert signed to unsigned.

This is definitely doable in C++ code but is there a way to do this conversion using IPP library? I didn't find proper API in the manual but probably I just didn't search well.

2 Replies
Beginner
1,078 Views

As long as the 16 bit signed integers are all positive values you can simply cast the signed values to unsigned values without any problem.The only difference in memory between signed and unsigned values are the negative numbers translate to unsigned values between 32,768 and 65,536. This works for me because we only use 12 bits of depth.
John

Quoting - Georgy Malyshev

Hello,

We use 3rd party component, which provides output as 16-bit signed integers. Later on we have to scale this image. IPP supports just unsigned data in ippiResize function so I have to convert signed to unsigned.

This is definitely doable in C++ code but is there a way to do this conversion using IPP library? I didn't find proper API in the manual but probably I just didn't search well.

New Contributor I
1,078 Views
Quoting - Georgy Malyshev

Hello,

We use 3rd party component, which provides output as 16-bit signed integers. Later on we have to scale this image. IPP supports just unsigned data in ippiResize function so I have to convert signed to unsigned.

This is definitely doable in C++ code but is there a way to do this conversion using IPP library? I didn't find proper API in the manual but probably I just didn't search well.

If the signed data includes negative values, centered at zero, then the question arises whether you want to convert the signed range of -2**15 to 2**15 - 1 to the unsigned range of 0 to 2**16 - 1. In that case, you want to add 0x80000000 to the signed value to produce the unsigned value. That would retain the full range of magnitude.