Developer Reference for Intel® Integrated Performance Primitives
Performs the threshold operation on the absolute values of elements of a vector.
IppStatus ippsThreshold_LTAbs_16s(const Ipp16s* pSrc, Ipp16s* pDst, int len, Ipp16s level);
IppStatus ippsThreshold_LTAbs_32s(const Ipp32s* pSrc, Ipp32s* pDst, int len, Ipp32s level);
IppStatus ippsThreshold_LTAbs_32f(const Ipp32f* pSrc, Ipp32f* pDst, int len, Ipp32f level);
IppStatus ippsThreshold_LTAbs_64f(const Ipp64f* pSrc, Ipp64f* pDst, int len, Ipp64f level);
IppStatus ippsThreshold_GTAbs_16s(const Ipp16s* pSrc, Ipp16s* pDst, int len, Ipp16s level);
IppStatus ippsThreshold_GTAbs_32s(const Ipp32s* pSrc, Ipp32s* pDst, int len, Ipp32s level);
IppStatus ippsThreshold_GTAbs_32f(const Ipp32f* pSrc, Ipp32f* pDst, int len, Ipp32f level);
IppStatus ippsThreshold_GTAbs_64f(const Ipp64f* pSrc, Ipp64f* pDst, int len, Ipp64f level);
IppStatus ippsThreshold_GTAbs_16s_I(Ipp16s* pSrcDst, int len, Ipp16s level);
IppStatus ippsThreshold_GTAbs_32s_I(Ipp32s* pSrcDst, int len, Ipp32s level);
IppStatus ippsThreshold_GTAbs_32f_I(Ipp32f* pSrcDst, int len, Ipp32f level);
IppStatus ippsThreshold_GTAbs_64f_I(Ipp64f* pSrcDst, int len, Ipp64f level);
IppStatus ippsThreshold_LTAbs_16s_I(Ipp16s* pSrcDst, int len, Ipp16s level);
IppStatus ippsThreshold_LTAbs_32s_I(Ipp32s* pSrcDst, int len, Ipp32s level);
IppStatus ippsThreshold_LTAbs_32f_I(Ipp32f* pSrcDst, int len, Ipp32f level);
IppStatus ippsThreshold_LTAbs_64f_I(Ipp64f* pSrcDst, int len, Ipp64f level);
ipps.h
Headers: ippcore.h, ippvm.h
Libraries: ippcore.lib, ippvm.lib
pSrc |
Pointer to the source vector. |
pDst |
Pointer to the destination vector. |
pSrcDst |
Pointer to the source and destination vector for the in-place operation. |
len |
Number of elements in the vector. |
level |
Value used to limit each element of source vector. This argument can not be negative. |
These functions implement thresholding of the vector pSrc by limiting absolute value of each element by the threshold value level. These functions perform the compare operation of the fixed type: ippsThreshold_LTAbs is for the "less than" comparison, while ippsThreshold_GTAbs is for the "greater than" comparison. Elements of the result vector pDst have the same sign that the source elements.
The in-place flavors perform the threshold operation on the vector pSrcDst.
ippsThreshold_LTAbs. The ippsThreshold_LTAbsfunction performs the operation “less than”, and level is a lower bound for the input. The formula for ippsThreshold_LTAbs is the following:
ippsThreshold_GTAbs. The function ippsThreshold_GTAbs performs the operation “greater than” and level is an upper bound for the input. The formula for ippsThreshold_GTAbs is the following:
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error if pSrc, pDst, or pSrcDst pointer is NULL. |
ippStsSizeErr |
Indicates an error if len is less than or equal to zero. |
ippStsThreshNegLevelErr |
Indicates an error if level is negative. |
Threshold_LtAbs:
/*******************************************************************************
* Copyright 2015 Intel Corporation.
*
*
* This software and the related documents are Intel copyrighted materials, and your use of them is governed by
* the express license under which they were provided to you ('License'). Unless the License provides otherwise,
* you may not use, modify, copy, publish, distribute, disclose or transmit this software or the related
* documents without Intel's prior written permission.
* This software and the related documents are provided as is, with no express or implied warranties, other than
* those that are expressly stated in the License.
*******************************************************************************/
#include <stdio.h>
#include "ipp.h"
/* Next two defines are created to simplify code reading and understanding */
#define EXIT_MAIN exitLine: /* Label for Exit */
#define check_sts(st) if((st) != ippStsNoErr) goto exitLine; /* Go to Exit if Intel® Integrated Primitives (Intel® IPP) function returned status different from ippStsNoErr */
/* Results of ippMalloc() are not validated because Intel® IPP functions perform bad arguments check and will return an appropriate status */
int main()
{
Ipp32f pVals[] = { 1, -3, 5, -7, 18, -24, 35, 48 };
Ipp32f pOutVals[8];
IppStatus status;
int i;
printf("Source vector\n");
for (i = 0; i < 8; i++) printf("%f ", pVals[i]);
check_sts(status = ippsThreshold_LTAbs_32f(pVals, pOutVals, 8, 10));
printf("Result values vector\n");
for (i = 0; i < 8; i++) printf("%f ", pOutVals[i]);
EXIT_MAIN
printf("Exit status %d (%s)\n", (int)status, ippGetStatusString(status));
return (int)status;
}
Threshold_LtAbs_I:
/*******************************************************************************
* Copyright 2015 Intel Corporation.
*
*
* This software and the related documents are Intel copyrighted materials, and your use of them is governed by
* the express license under which they were provided to you ('License'). Unless the License provides otherwise,
* you may not use, modify, copy, publish, distribute, disclose or transmit this software or the related
* documents without Intel's prior written permission.
* This software and the related documents are provided as is, with no express or implied warranties, other than
* those that are expressly stated in the License.
*******************************************************************************/
#include <stdio.h>
#include "ipp.h"
/* Next two defines are created to simplify code reading and understanding */
#define EXIT_MAIN exitLine: /* Label for Exit */
#define check_sts(st) if((st) != ippStsNoErr) goto exitLine; /* Go to Exit if Intel® Integrated Primitives (Intel® IPP) function returned status different from ippStsNoErr */
/* Results of ippMalloc() are not validated because Intel® IPP functions perform bad arguments check and will return an appropriate status */
int main()
{
Ipp32f pVals[] = { 1, -3, 5, -7, 18, -24, 35, 48 };
IppStatus status;
int i;
printf("Source vector\n");
for (i = 0; i < 8; i++) printf("%f ", pVals[i]);
check_sts(status = ippsThreshold_LTAbs_32f_I(pVals, 8, 10));
printf("Result values vector\n");
for (i = 0; i < 8; i++) printf("%f ", pVals[i]);
EXIT_MAIN
printf("Exit status %d (%s)\n", (int)status, ippGetStatusString(status));
return (int)status;
}