From 2b57b56062dc5d655252c378005e21df3651ef5f Mon Sep 17 00:00:00 2001 From: HazarathKumarM Date: Wed, 7 Aug 2024 14:32:27 +0000 Subject: [PATCH] Add pixelate algorithm description as a comment --- src/modules/rppt_tensor_effects_augmentations.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/modules/rppt_tensor_effects_augmentations.cpp b/src/modules/rppt_tensor_effects_augmentations.cpp index a9c86c3c7..789767735 100644 --- a/src/modules/rppt_tensor_effects_augmentations.cpp +++ b/src/modules/rppt_tensor_effects_augmentations.cpp @@ -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) @@ -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)