Reusing Buffers

Some Intel® IPP functions require internal memory for various optimization strategies. At the same time you should be well aware that memory allocation inside of the function may have a negative impact on performance in some situations, for example, in the case of cache misses. To avoid or minimize memory allocation and keep your data in warm cache, some functions, for example, FFT and DFT transform, can use or reuse memory given as a parameter to the function. 

If you have to call a FFT function many times, the reuse of an external buffer results in better performance. A simple example of this kind of processing is perform filtering using FFT transform or computing FFT as two FFT in two separate threads

ippsFFTInitAlloc_C_32fc(  &ctxN2, order-1, IPP_FFT_DIV_INV_BY_N, ippAlgHintAccurate );    

ippsFFTGetBufSize_C_32fc( ctxN2, &sz );
buffer = sz > 0 ? ippsMalloc_8u( sz ) : 0;
int phase = 0;
/// prepare source data for two FFTs
ippsSampleDown_32fc( x, fftlen, xleft, &fftlen2, 2, &phase );
phase = 1;
ippsSampleDown_32fc( x, fftlen, xrght, &fftlen2, 2, &phase );
/// two FFTs may be calculated separately in two threads
ippsFFTFwd_CToC_32fc( xleft, Xleft, ctxN2, buffer );
ippsFFTFwd_CToC_32fc( xrght, Xrght, ctxN2, buffer );

The external buffer is not necessary. If the pointer to the buffer is 0, the function allocates memory inside.