1 | initial version |
The correct method for utilizing the gaussian filter function in the CUDA Npp library is as follows:
#include <npp.h>
#include <nppi_filtering_functions.h>
NppiSize sizeROI = { width, height };
NppiSize maskSize = { maskWidth, maskHeight };
int nBufferSize = 0;
Npp8u* pBuffer = 0;
Npp8u* pSrcDst = 0;
int nSrcDstStep = 0;
NppiPoint anchor = { maskWidth / 2, maskHeight / 2 };
nppiMalloc(&pSrcDst, nSrcDstStep * height);
nppiSet_8u_C1R(0, pSrcDst, nSrcDstStep, sizeROI);
nppiFilterGaussBorderGetBufferSize(sizeROI, maskSize, &nBufferSize);
cudaMalloc(&pBuffer, nBufferSize);
nppiFilterGaussBorder_8u_C1R(pSrcDst, nSrcDstStep, sizeROI, maskSize, anchor, pBuffer);
cudaFree(pBuffer);
nppiFree(pSrcDst);
Note that the above code assumes that you have already defined the input and output size (width and height), mask size (maskWidth and maskHeight), and source/destination step (nSrcDstStep).