Skip to content

Commit

Permalink
Merge pull request #312 from fiona-gladwin/sn/pixelate_tensor
Browse files Browse the repository at this point in the history
RPP Pixelate - Address Review Comments
  • Loading branch information
r-abishek authored Aug 7, 2024
2 parents 2c44bb2 + 2b57b56 commit 9db27db
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/modules/rppt_tensor_effects_augmentations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,13 @@ RppStatus rppt_pixelate_host(RppPtr_t srcPtr,
RpptRoiType roiType,
rppHandle_t rppHandle)
{

// This function performs pixelation through a two-step resizing process:
// 1. The image is first resized to a smaller intermediate size using bilinear interpolation.
// 2. The intermediate image is then resized back to the original size using nearest neighbor interpolation.
// The bilinear step reduces the image dimensions smoothly, and the nearest neighbor step enlarges it back,
// resulting in a pixelated effect as the intermediate pixels are repeated in the final image.

if ((srcDescPtr->layout != RpptLayout::NCHW) && (srcDescPtr->layout != RpptLayout::NHWC)) return RPP_ERROR_INVALID_SRC_LAYOUT;
if ((dstDescPtr->layout != RpptLayout::NCHW) && (dstDescPtr->layout != RpptLayout::NHWC)) return RPP_ERROR_INVALID_DST_LAYOUT;
if (pixelationPercentage < 0 || pixelationPercentage > 100)
Expand Down Expand Up @@ -2158,6 +2165,12 @@ RppStatus rppt_pixelate_gpu(RppPtr_t srcPtr,
{
#ifdef HIP_COMPILE

// This function performs pixelation through a two-step resizing process:
// 1. The image is first resized to a smaller intermediate size using bilinear interpolation.
// 2. The intermediate image is then resized back to the original size using nearest neighbor interpolation.
// The bilinear step reduces the image dimensions smoothly, and the nearest neighbor step enlarges it back,
// resulting in a pixelated effect as the intermediate pixels are repeated in the final image.

if ((srcDescPtr->layout != RpptLayout::NCHW) && (srcDescPtr->layout != RpptLayout::NHWC)) return RPP_ERROR_INVALID_SRC_LAYOUT;
if ((dstDescPtr->layout != RpptLayout::NCHW) && (dstDescPtr->layout != RpptLayout::NHWC)) return RPP_ERROR_INVALID_DST_LAYOUT;
if (pixelationPercentage < 0 || pixelationPercentage > 100)
Expand Down

0 comments on commit 9db27db

Please sign in to comment.