Quantcast
Channel: Intel® Software - Intel® Integrated Performance Primitives
Viewing all articles
Browse latest Browse all 1489

How to clamp/clip some data?

$
0
0

Hi there,

I'd like to take advantage of IPP library and vectorization, applying a clamp/clip to an array of double (or better, to a sum of each item in two arrays of double).

Actual code is somethings like this:

double *pStart = mStartVoicesValues[voiceIndex];	
double *pMod = pModValues + voiceIndex * bufferSize;
double *pValue = mProcessedValues[voiceIndex];	

for (int sampleIndex = 0; sampleIndex < blockSize; sampleIndex++) {
	pValue[sampleIndex] = std::clamp(pStart[sampleIndex] + pMod[sampleIndex], 0.0, 1.0);
}

Called often, with variable blockSize. It sum each other pStart and pMod, and clip if they are below/over 0.0/1.0 (for each value on each array). Clearly, the three arrays are equals in sizes. Note: I could also copy the result on pStart, without using the third array pValue.

Which IPP do you suggest?

Thanks


Viewing all articles
Browse latest Browse all 1489

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>