Skip to content

RPP JPEG compression HOST : Resolve review comments#426

Merged
r-abishek merged 1 commit intor-abishek:ar/opt_jpeg_distortion_hostfrom
HazarathKumarM:hk/jpeg_distortion_host
Apr 25, 2025
Merged

RPP JPEG compression HOST : Resolve review comments#426
r-abishek merged 1 commit intor-abishek:ar/opt_jpeg_distortion_hostfrom
HazarathKumarM:hk/jpeg_distortion_host

Conversation

@HazarathKumarM
Copy link
Copy Markdown
Collaborator

  • Resolved the review comments

@HazarathKumarM HazarathKumarM changed the title resolve review comments RPP JPEG compression HOST : Resolve review comments Apr 25, 2025
@r-abishek r-abishek requested a review from Copilot April 25, 2025 23:37
@r-abishek r-abishek added the enhancement New feature or request label Apr 25, 2025
@r-abishek r-abishek added this to the sow12ms2 milestone Apr 25, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR resolves review comments related to JPEG compression for HOST and refines several DCT and quantization routines, along with minor documentation updates. Key changes include:

  • Replacing hardcoded test case boundaries with dynamic values from imageAugmentationMap in runImageTests.py.
  • Refactoring DCT, quantization, and inverse DCT routines in jpeg_compression_distortion.cpp, including the introduction of helper functions clamp() and get_mul_add().
  • Updating function documentation in rppt_tensor_geometric_augmentations.h regarding the JPEG quality factor range.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
utilities/test_suite/HOST/runImageTests.py Switched to dynamic case boundary based on imageAugmentationMap keys.
src/modules/tensor/cpu/kernel/jpeg_compression_distortion.cpp Refactored DCT/IDCT implementations with added helper functions and enhanced inline documentation.
api/rppt_tensor_geometric_augmentations.h Updated parameter documentation for JPEG quality factor.
Comments suppressed due to low confidence (1)

src/modules/tensor/cpu/kernel/jpeg_compression_distortion.cpp:180

  • Ensure that the refactored dct_8x8_1d_core logic—with the reduced temporary storage and reordered computations—preserves the mathematical properties of the original DCT. Consider adding unit tests to validate the transformation.
T temp[8];

Comment on lines +42 to +43
caseMin = min(imageAugmentationMap.keys())
caseMax = max(imageAugmentationMap.keys())
Copy link

Copilot AI Apr 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before using min() and max() on imageAugmentationMap.keys(), verify that imageAugmentationMap is non‐empty to prevent potential runtime exceptions.

Suggested change
caseMin = min(imageAugmentationMap.keys())
caseMax = max(imageAugmentationMap.keys())
if imageAugmentationMap:
caseMin = min(imageAugmentationMap.keys())
caseMax = max(imageAugmentationMap.keys())
else:
raise ValueError("imageAugmentationMap is empty. Cannot determine caseMin and caseMax.")

Copilot uses AI. Check for mistakes.
template <typename T>
inline T clamp(T val, T minVal, T maxVal)
{
return (val < minVal) ? minVal : (val > maxVal) ? maxVal : val;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the most optimal, this is a very generic function that need not be inside jpeg_compression_distortion.cpp specifically. Could be outside so other functions could use it. Can be changed later.

Copy link
Copy Markdown
Owner

@r-abishek r-abishek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@r-abishek r-abishek merged commit 10306c0 into r-abishek:ar/opt_jpeg_distortion_host Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants