One thing I discovered yesterday is that the image convolution filters implemented in NPP (such as nppiFilterBorder_8u) are only partially implemented! These family of functions are asserted to provide border control for the convolution, thus serving as a robust alternative to the regular image convolution functions in NPP (such as nppiFilter_8u). The catch is that the border control is only partially working.
The documentation on these functions is scarce. These functions expect an argument of type NppiBorderType to define their border treatment. Possible options are:
NPP_BORDER_NONE: no border treatment
NPP_BORDER_CONSTANT: (probably) assume constant values at out of bounds pixels
NPP_BORDER_REPLICATE: replicate edge pixels and use them as values for out of bounds pixels
NPP_BORDER_WRAP: round-robin treatment of borders
My experiments showed that the only working option is NPP_BORDER_REPLICATE. Any other option would result in the NPPStatus error code of -9999 (equivalent to NPP_NOT_SUPPORTED_MODE_ERROR, for which I have, again, not found any documentations).
Seeing as the performance of the border-controlled convolutions is inferior to the box filter function (using large mask sizes), my assumption is that the NPP_BORDER_REPLICATE uses the nppiCopyConstBorder_8u function to implement its border-control.
Possible options include implementing the border control manually, if behaviors other than replication are desired.