Converts the data type of a vector and stores the results in a second vector.
IppStatus ippsConvert_8s16s(const Ipp8s* pSrc,Ipp16s* pDst, int len);
IppStatus ippsConvert_8s32f(const Ipp8s* pSrc, Ipp32f* pDst, int len);
IppStatus ippsConvert_8u32f(const Ipp8u* pSrc, Ipp32f* pDst, int len);
IppStatus ippsConvert_16s8s_Sfs(const Ipp16s* pSrc, Ipp8s* pDst, Ipp32u len, IppRoundMode rndMode, int scaleFactor);
IppStatus ippsConvert_16s32s(const Ipp16s* pSrc, Ipp32s* pDst, int len);
IppStatus ippsConvert_16s32f(const Ipp16s* pSrc, Ipp32f* pDst, int len);
IppStatus ippsConvert_16u32f(const Ipp16u* pSrc, Ipp32f* pDst, int len);
IppStatus ippsConvert_32s16s(const Ipp32s* pSrc, Ipp16s* pDst, int len);
IppStatus ippsConvert_32s32f(const Ipp32s* pSrc, Ipp32f* pDst, int len);
IppStatus ippsConvert_32s64f(const Ipp32s* pSrc, Ipp64f* pDst, int len);
IppStatus ippsConvert_32f64f(const Ipp32f* pSrc, Ipp64f* pDst, int len);
IppStatus ippsConvert_64s64f(const Ipp64s* pSrc, Ipp64f* pDst, int len);
IppStatus ippsConvert_64f32f(const Ipp64f* pSrc, Ipp32f* pDst, int len);
IppStatus ippsConvert_16s32f_Sfs(const Ipp16s* pSrc, Ipp32f* pDst, int len, int scaleFactor);
IppStatus ippsConvert_16s64f_Sfs(const Ipp16s* pSrc, Ipp64f* pDst, int len, int scaleFactor);
IppStatus ippsConvert_32s16s_Sfs(const Ipp32s* pSrc, Ipp16s* pDst, int len, int scaleFactor);
IppStatus ippsConvert_32s32f_Sfs(const Ipp32s* pSrc, Ipp32f* pDst, int len, int scaleFactor);
IppStatus ippsConvert_32s64f_Sfs(const Ipp32s* pSrc, Ipp64f* pDst, int len, int scaleFactor);
IppStatus ippsConvert_32f8s_Sfs(const Ipp32f* pSrc, Ipp8s* pDst, int len, IppRoundMode rndMode, int scaleFactor);
IppStatus ippsConvert_32f8u_Sfs(const Ipp32f* pSrc, Ipp8u* pDst, int len, IppRoundMode rndMode, int scaleFactor);
IppStatus ippsConvert_32f16s_Sfs(const Ipp32f* pSrc, Ipp16s* pDst, int len, IppRoundMode rndMode, int scaleFactor);
IppStatus ippsConvert_32f16u_Sfs(const Ipp32f* pSrc, Ipp16u* pDst, int len, IppRoundMode rndMode, int scaleFactor);
IppStatus ippsConvert_32f32s_Sfs(const Ipp32f* pSrc, Ipp32s* pDst, int len, IppRoundMode rndMode, int scaleFactor);
IppStatus ippsConvert_64s32s_Sfs(const Ipp64s* pSrc, Ipp32s* pDst, int len, IppRoundMode rndMode, int scaleFactor);
IppStatus ippsConvert_64f16s_Sfs(const Ipp64f* pSrc, Ipp16s* pDst, int len, IppRoundMode rndMode, int scaleFactor);
IppStatus ippsConvert_64f32s_Sfs(const Ipp64f* pSrc, Ipp32s* pDst, int len, IppRoundMode rndMode, int scaleFactor);
IppStatus ippsConvert_64f64s_Sfs(const Ipp64f* pSrc, Ipp64s* pDst, Ipp32f len, IppRoundMode rndMode, int scaleFactor);
IppStatus ippsConvert_24u32u(const Ipp8u* pSrc, Ipp32u* pDst, int len);
IppStatus ippsConvert_24u32f(const Ipp8u* pSrc, Ipp32f* pDst, int len);
IppStatus ippsConvert_32u24u_Sfs(const Ipp32u* pSrc, Ipp8u* pDst, int len, int scaleFactor);
IppStatus ippsConvert_32f24u_Sfs(const Ipp32f* pSrc, Ipp8u* pDst, int len, int scaleFactor);
IppStatus ippsConvert_24s32s(const Ipp8u* pSrc, Ipp32s* pDst, int len);
IppStatus ippsConvert_24s32f(const Ipp8u* pSrc, Ipp32f* pDst, int len);
IppStatus ippsConvert_32s24s_Sfs(const Ipp32s* pSrc, Ipp8u* pDst, int len, int scaleFactor);
IppStatus ippsConvert_32f24s_Sfs(const Ipp32f* pSrc, Ipp8u* pDst, int len, int scaleFactor);
IppStatus ippsConvert_16s16f(const Ipp16s* pSrc, Ipp16f* pDst, int len, IppRoundMode rndMode);
IppStatus ippsConvert_32f16f(const Ipp32f* pSrc, Ipp16f* pDst, int len, IppRoundMode rndMode);
IppStatus ippsConvert_16f16s_Sfs(const Ipp16f* pSrc, Ipp16s* pDst, int len, IppRoundMode rndMode, int scaleFactor);
IppStatus ippsConvert_16f32f(const Ipp16f* pSrc, Ipp32f* pDst, int len);
pSrc |
Pointer to the source vector. |
pDst |
Pointer to the destination vector. |
rndMode |
Rounding mode, the following values are possible: |
ippRndZero specifies that floating-point values are truncated toward zero |
|
ippRndNear specifies that floating-point values are rounded to the nearest even integer when the fractional part equals 0.5; otherwise they are rounded to the nearest integer |
|
ippRndFinancial specifies that floating-point values are rounded down to the nearest integer when the fractional part is less than 0.5, or rounded up to the nearest integer if the fractional part is equal or greater than 0.5. |
|
len |
Number of elements in the vector. |
scaleFactor |
Scale factor, refer to Integer Scaling. |
The function ippsConvert is declared in the ipps.h file. This function converts the type of data contained in the vector pSrc and stores the results in pDst.
Functions with Sfs suffixes perform scaling of the result value in accordance with the scaleFactor value. The converted result is saturated if it exceeds the output data range.
Functions that operate with 16f data do not support the ippRndFinancial rounding mode.
The example below shows how to use the function ippsConvert.
ippsConvert_32f16f This function has the following specific when it processes the number that are not in the range [MinVal16f..MaxVal16f]:
If x > MaxVal16f then {
If ( rndMode == IppRndNear ) then {
y = Convert_32f16f (x) = +INF
}
If ( rndMode == IppRndZero ) then {
If ( x == +INF ) then {
y = Convert_32f16f (x) = +INF
} else {
y = Convert_32f16f(x) = MaxVal16f
}
}
}
If x < MinVal16f then {
If ( rndMode == IppRndNear ) then {
y = Convert_32f16f (x) = -INF
}
If ( rndMode == IppRndZero ) then {
If ( x == -INF ) then {
y = Convert_32f16f (x) = -INF
} else {
y = Convert_32f16f(x) = M in Val16f
}
}
}
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error when the pDst or pSrc pointer is NULL. |
ippStsSizeErr |
Indicates an error when len is less than or equal to 0. |
ippStsRoundModeNotSupportedErr |
Indicates an error when the specified rounding mode is not supported. |
Ipp32s src32s[2] = { 33000, -33000 };
Ipp32f src32f[2] = { 126.6, -125.4 };
Ipp32f src_32f[2] = { 113.12, -113.6 };
Ipp32f src1_32f[5] = { -2.5, -2.4, 1.4, 1.5, 1.6};
Ipp8s src_8s[2] = { 125, -125 };
Ipp8u src8[1] = { 255 };
Ipp32f dst32f[1];
Ipp16s dst16[2];
Ipp16s dst_16s[2];
Ipp8u dst8u[2];
Ipp8s dstN8[2];
Ipp8s dstZ8[2];
int scaleFactor = 0; // no scaling
ippsConvert_8s16s ( src_8s, dst_16s, 2 );
ippsConvert_8u32f ( src8, dst32f, 1 );
ippsConvert_32s16s ( src32s, dst16, 2 );
ippsConvert_32f8s_Sfs ( src32f, dstN8, 2, ippRndNear, scaleFactor );
ippsConvert_32f8s_Sfs ( src32f, dstZ8, 2, ippRndZero, scaleFactor );
ippsConvert_32f8u_Sfs ( src_32f, dst8u, 2, ippRndNear, scaleFactor );
ippsConvert_32f8s_Sfs ( src1_32f, dstF8, 5, ippRndFinancial, scaleFactor );
result:
8s16s >> dst_16s = { 125, -125}
8u32f >> dst32f = { 255.0 }
32s16s >> dst16 = { 32767, -32768} // max, min 16s values
// results for scaleFactor = 0
32f8s_Sfs >> dstN8 = { 127, -125 } // scaleFactor = 0
32f8s_Sfs >> dstZ8 = { 126, -125 } // scaleFactor = 0
32f8s_Sfs >> dstF8 = { -3, -2, 1, 2, 2 } // scaleFactor = 0
32f8u_Sfs >> dst8u = { 113, 0 } // scaleFactor = 0
// results for scaleFactor = 2
32f8s_Sfs >> dstN8 = { 32, -31 } // scaleFactor = 2
32f8s_Sfs >> dstZ8 = { 31, -31 } // scaleFactor = 2
32f8u_Sfs >> dst8u = { 28, 0 } // scaleFactor = 2
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.