RPP filter augmentations#
-
RppStatus rppt_box_filter(RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t dstPtr, RpptDescPtr dstDescPtr, Rpp32u kernelSize, RpptImageBorderType borderType, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend)#
Box Filter augmentation on HIP/HOST backend for a NCHW/NHWC layout tensor.
The box filter augmentation runs for a batch of RGB(3 channel) / greyscale(1 channel) images with an NHWC/NCHW tensor layout.
srcPtr depth ranges - Rpp8u (0 to 255), Rpp16f (0 to 1), Rpp32f (0 to 1), Rpp8s (-128 to 127).
dstPtr depth ranges - Will be same depth as srcPtr.
Sample Input#
Sample 3x3 Output#
Sample 5x5 Output#
Sample 7x7 Output#
Sample 9x9 Output#
- Parameters:
srcPtr – [in] source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)
srcDescPtr – [in] source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3)
dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)
dstDescPtr – [in] destination tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = same as that of srcDescPtr)
kernelSize – [in] kernel size for box filter (a single Rpp32u number with kernelSize > 0 that applies to all images in the batch. kernelSize = 3/5/7/9 are optimized to run faster)
borderType – [in] border type for padding during filtering (Restrictions - RpptImageBorderType::REPLICATE only mode supported)
roiTensorPtrSrc – [in] ROI data in HIP memory (for HIP backend) or HOST memory (for HOST backend), for each image in source tensor (2D tensor of size batchSize * 4, in either format - XYWH(xy.x, xy.y, roiWidth, roiHeight) or LTRB(lt.x, lt.y, rb.x, rb.y))
roiType – [in] ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB)
rppHandle – [in] RPP HIP/HOST handle created with
rppCreate()executionBackend – [in] backend for execution (RppBackend::RPP_HOST_BACKEND or RppBackend::RPP_HIP_BACKEND)
- Return values:
RPP_SUCCESS – Successful completion.
RPP_ERROR* – Unsuccessful completion.
- Returns:
A
RppStatusenumeration.
-
RppStatus rppt_median_filter(RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t dstPtr, RpptDescPtr dstDescPtr, Rpp32u kernelSize, RpptImageBorderType borderType, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend)#
Median Filter augmentation on HIP/HOST backend for a NCHW/NHWC layout tensor.
The median filter replaces each pixel’s value with the median of its surrounding pixels in a square window of size kernel size x kernel size. The Median filter augmentation runs for a batch of RGB(3 channel) / greyscale(1 channel) images with an NHWC/NCHW tensor layout.
srcPtr depth ranges - Rpp8u (0 to 255), Rpp16f (0 to 1), Rpp32f (0 to 1), Rpp8s (-128 to 127).
dstPtr depth ranges - Will be same depth as srcPtr.
Sample Input#
Sample 3x3 Output#
Sample 5x5 Output#
Sample 7x7 Output#
Sample 9x9 Output#
- Parameters:
srcPtr – [in] source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)
srcDescPtr – [in] source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3)
dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)
dstDescPtr – [in] destination tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = same as that of srcDescPtr)
kernelSize – [in] kernel size for median filter (a single Rpp32u number with kernelSize > 0 that applies to all images in the batch. kernelSize = 3/5/7/9 are optimized to run faster)
borderType – [in] Border type for padding in the median filter (currently, only RpptImageBorderType::REPLICATE is supported)
roiTensorPtrSrc – [in] ROI data in HIP memory (for HIP backend) or HOST memory (for HOST backend), for each image in source tensor (2D tensor of size batchSize * 4, in either format - XYWH(xy.x, xy.y, roiWidth, roiHeight) or LTRB(lt.x, lt.y, rb.x, rb.y))
roiType – [in] ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB)
rppHandle – [in] RPP HIP/HOST handle created with
rppCreate()executionBackend – [in] backend for execution (RppBackend::RPP_HOST_BACKEND or RppBackend::RPP_HIP_BACKEND)
- Return values:
RPP_SUCCESS – Successful completion.
RPP_ERROR* – Unsuccessful completion.
- Returns:
A
RppStatusenumeration.
-
RppStatus rppt_gaussian_filter(RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t dstPtr, RpptDescPtr dstDescPtr, Rpp32f *stdDevTensor, Rpp32u kernelSize, RpptImageBorderType borderType, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend)#
Gaussian Filter augmentation on HIP/HOST backend for a NCHW/NHWC layout tensor.
The Gaussian filter augmentation runs for a batch of RGB(3 channel) / greyscale(1 channel) images with an NHWC/NCHW tensor layout.
srcPtr depth ranges - Rpp8u (0 to 255), Rpp16f (0 to 1), Rpp32f (0 to 1), Rpp8s (-128 to 127).
dstPtr depth ranges - Will be same depth as srcPtr.
Sample Input#
Sample 3x3 Output#
Sample 5x5 Output#
Sample 7x7 Output#
Sample 9x9 Output#
- Parameters:
srcPtr – [in] source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)
srcDescPtr – [in] source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3)
dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)
dstDescPtr – [in] destination tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = same as that of srcDescPtr)
stdDevTensor – [in] stdDev values for gaussian calculation (1D tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend), of size batchSize, for each image in batch)
kernelSize – [in] kernel size for gaussian filter (a single Rpp32u number with kernelSize > 0 that applies to all images in the batch. kernelSize = 3/5/7/9 are optimized to run faster)
borderType – [in] border type for padding during filtering (Restrictions - RpptImageBorderType::REPLICATE only mode supported)
roiTensorPtrSrc – [in] ROI data in HIP memory (for HIP backend) or HOST memory (for HOST backend), for each image in source tensor (2D tensor of size batchSize * 4, in either format - XYWH(xy.x, xy.y, roiWidth, roiHeight) or LTRB(lt.x, lt.y, rb.x, rb.y))
roiType – [in] ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB)
rppHandle – [in] RPP HIP/HOST handle created with
rppCreate()executionBackend – [in] backend for execution (RppBackend::RPP_HOST_BACKEND or RppBackend::RPP_HIP_BACKEND)
- Return values:
RPP_SUCCESS – Successful completion.
RPP_ERROR* – Unsuccessful completion.
- Returns:
A
RppStatusenumeration.
-
RppStatus rppt_sobel_filter(RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t dstPtr, RpptDescPtr dstDescPtr, Rpp32u sobelType, Rpp32u kernelSize, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend)#
Sobel Filter augmentation on HIP/HOST backend for a NHWC/NCHW layout tensor.
The sobel filter augmentation runs for a batch of RGB(3 channel) / greyscale(1 channel) images with NHWC/NCHW tensor layout.
srcPtr depth ranges - Rpp8u (0 to 255), Rpp16f (0 to 1), Rpp32f (0 to 1), Rpp8s (-128 to 127).
dstPtr depth ranges - Will be same depth as srcPtr.
Sample Input#
Sample 3x3 Output#
Sample 5x5 Output#
Sample 7x7 Output#
Sample 3x3 Output#
Sample 5x5 Output#
Sample 7x7 Output#
Sample 3x3 Output#
Sample 5x5 Output#
Sample 7x7 Output#
- Parameters:
srcPtr – [in] source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)
srcDescPtr – [in] source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3)
dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)
dstDescPtr – [in] destination tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW, c = 1)
sobelType – [in] sobel type for sobel filter (a single Rpp32u number with sobelType = 0 (X Gradient) / 1 (Y Gradient) / 2 (XY Gradient) that applies to all images in the batch)
kernelSize – [in] kernel size for sobel filter (a single Rpp32u odd number with kernelSize = 3/5/7 that applies to all images in the batch)
roiTensorPtrSrc – [in] ROI data in HIP memory (for HIP backend) or HOST memory (for HOST backend), for each image in source tensor (2D tensor of size batchSize * 4, in either format - XYWH(xy.x, xy.y, roiWidth, roiHeight) or LTRB(lt.x, lt.y, rb.x, rb.y))
roiType – [in] ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB)
rppHandle – [in] RPP HIP/HOST handle created with
rppCreate()executionBackend – [in] backend for execution (RppBackend::RPP_HOST_BACKEND or RppBackend::RPP_HIP_BACKEND)
- Return values:
RPP_SUCCESS – Successful completion.
RPP_ERROR* – Unsuccessful completion.
- Returns:
A
RppStatusenumeration.
-
RppStatus rppt_emboss(RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t dstPtr, RpptDescPtr dstDescPtr, Rpp32f *strength, Rpp32u kernelSize, RpptImageBorderType borderType, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend)#
Emboss augmentation on HIP/HOST backend for a NCHW/NHWC layout tensor.
The emboss augmentation runs for a batch of RGB(3 channel) / greyscale(1 channel) images with an NHWC/NCHW tensor layout.
srcPtr depth ranges - Rpp8u (0 to 255), Rpp16f (0 to 1), Rpp32f (0 to 1), Rpp8s (-128 to 127).
dstPtr depth ranges - Will be same depth as srcPtr.
Sample Input#
Sample 3x3 Output#
Sample 5x5 Output#
Sample 7x7 Output#
Sample 9x9 Output#
- Parameters:
srcPtr – [in] source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)
srcDescPtr – [in] source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3)
dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)
dstDescPtr – [in] destination tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = same as that of srcDescPtr)
strength – [in] strength values for emboss calculation (1D tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend), of size batchSize, for each image in batch)
kernelSize – [in] kernel size for emboss (a single Rpp32u odd number with kernelSize = 3/5/7/9 that applies to all images in the batch)
borderType – [in] border type for padding during filtering (Restrictions - RpptImageBorderType::REPLICATE only mode supported)
roiTensorPtrSrc – [in] ROI data in HIP memory (for HIP backend) or HOST memory (for HOST backend), for each image in source tensor (2D tensor of size batchSize * 4, in either format - XYWH(xy.x, xy.y, roiWidth, roiHeight) or LTRB(lt.x, lt.y, rb.x, rb.y))
roiType – [in] ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB)
rppHandle – [in] RPP HIP/HOST handle created with
rppCreate()executionBackend – [in] backend for execution (RppBackend::RPP_HOST_BACKEND or RppBackend::RPP_HIP_BACKEND)
- Return values:
RPP_SUCCESS – Successful completion.
RPP_ERROR* – Unsuccessful completion.
- Returns:
A
RppStatusenumeration.
-
RppStatus rppt_bilateral_filter(RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t dstPtr, RpptDescPtr dstDescPtr, Rpp32f *stdDevSpaceTensor, Rpp32f *stdDevRangeTensor, Rpp32u kernelSize, RpptImageBorderType borderType, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend)#
Bilateral Filter augmentation on HIP/HOST backend for a NCHW/NHWC layout tensor.
The bilateral filter augmentation runs for a batch of RGB(3 channel) / greyscale(1 channel) images with an NHWC/NCHW tensor layout. It is an edge-preserving smoothing: each output pixel is the normalized weighted mean of its kernelSize x kernelSize neighbourhood, where a neighbour’s weight is the product of a spatial Gaussian on its offset (stdDevSpaceTensor) and a range Gaussian on the difference between its value and the centre pixel’s (stdDevRangeTensor). Each channel is filtered independently: the range term uses that channel’s own difference.
weight(dy, dx) = exp(-(dy^2 + dx^2) / (2 * stdDevSpace^2)) * exp(-(v - v0)^2 / (2 * stdDevRange^2))
srcPtr depth ranges - Rpp8u (0 to 255), Rpp16f (0 to 1), Rpp32f (0 to 1), Rpp8s (-128 to 127).
dstPtr depth ranges - Will be same depth as srcPtr.
- Parameters:
srcPtr – [in] source tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)
srcDescPtr – [in] source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3)
dstPtr – [out] destination tensor in HIP memory (for HIP backend) or HOST memory (for HOST backend)
dstDescPtr – [in] destination tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = same as that of srcDescPtr)
stdDevSpaceTensor – [in] spatial standard deviation in pixels (1D tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend), of size batchSize, for each image in batch, with stdDevSpaceTensor[i] > 0)
stdDevRangeTensor – [in] range (intensity) standard deviation in the same units as the pixel values - 0 to 255 scale for Rpp8u/Rpp8s, 0 to 1 scale for Rpp16f/Rpp32f (1D tensor in pinned / HIP memory (for HIP backend) or HOST memory (for HOST backend), of size batchSize, for each image in batch, with stdDevRangeTensor[i] > 0)
kernelSize – [in] kernel size for bilateral filter (a single Rpp32u odd number with kernelSize = 3/5/7/9 that applies to all images in the batch)
borderType – [in] border type for padding during filtering (Restrictions - RpptImageBorderType::REPLICATE only mode supported)
roiTensorPtrSrc – [in] ROI data in HIP memory (for HIP backend) or HOST memory (for HOST backend), for each image in source tensor (2D tensor of size batchSize * 4, in either format - XYWH(xy.x, xy.y, roiWidth, roiHeight) or LTRB(lt.x, lt.y, rb.x, rb.y))
roiType – [in] ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB)
rppHandle – [in] RPP HIP/HOST handle created with
rppCreate()executionBackend – [in] backend for execution (RppBackend::RPP_HOST_BACKEND or RppBackend::RPP_HIP_BACKEND)
- Return values:
RPP_SUCCESS – Successful completion.
RPP_ERROR* – Unsuccessful completion.
- Returns:
A
RppStatusenumeration.
-
RppStatus rppt_prewitt_filter(RppPtr_t srcPtr, RpptDescPtr srcDescPtr, RppPtr_t dstPtr, RpptDescPtr dstDescPtr, Rpp32u prewittType, RpptImageBorderType borderType, RpptROIPtr roiTensorPtrSrc, RpptRoiType roiType, rppHandle_t rppHandle, RppBackend executionBackend)#
Prewitt Filter augmentation on HOST only backend for a NCHW/NHWC layout tensor.
The prewitt filter augmentation runs for a batch of RGB(3 channel) / greyscale(1 channel) images with an NHWC/NCHW tensor layout. It is a first-order edge detector: two 3x3 kernels estimate the horizontal and vertical intensity derivative, and prewittType selects which is written. Each channel is filtered independently.
Gx = [-1 0 1; -1 0 1; -1 0 1], Gy = [-1 -1 -1; 0 0 0; 1 1 1]
prewittType = 0 -> gx, 1 -> gy, 2 -> sqrt(gx^2 + gy^2)
The result is saturated to the destination range, so negative gradients store as the range minimum.
srcPtr depth ranges - Rpp8u (0 to 255), Rpp16f (0 to 1), Rpp32f (0 to 1), Rpp8s (-128 to 127).
dstPtr depth ranges - Will be same depth as srcPtr.
- Parameters:
srcPtr – [in] source tensor in HOST memory (for HOST backend)
srcDescPtr – [in] source tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = 1/3)
dstPtr – [out] destination tensor in HOST memory (for HOST backend)
dstDescPtr – [in] destination tensor descriptor (Restrictions - numDims = 4, offsetInBytes >= 0, dataType = U8/F16/F32/I8, layout = NCHW/NHWC, c = same as that of srcDescPtr)
prewittType – [in] gradient written to the destination (a single Rpp32u number with prewittType = 0 (X Gradient) / 1 (Y Gradient) / 2 (XY Gradient magnitude) that applies to all images in the batch)
borderType – [in] border type for padding during filtering (Restrictions - RpptImageBorderType::REPLICATE only mode supported)
roiTensorPtrSrc – [in] ROI data in HOST memory (for HOST backend), for each image in source tensor (2D tensor of size batchSize * 4, in either format - XYWH(xy.x, xy.y, roiWidth, roiHeight) or LTRB(lt.x, lt.y, rb.x, rb.y))
roiType – [in] ROI type used (RpptRoiType::XYWH or RpptRoiType::LTRB)
rppHandle – [in] RPP HOST handle created with
rppCreate()executionBackend – [in] backend for execution (RppBackend::RPP_HOST_BACKEND)
- Return values:
RPP_SUCCESS – Successful completion.
RPP_ERROR* – Unsuccessful completion.
- Returns:
A
RppStatusenumeration.