Open
Conversation
In Fused rocJpeg decoder, add support to update the actual width and height before decoding itself as the values will be updated before that This reduces looping twice
…/rocAL into fg/rocjpeg_acc_fix
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses accuracy/ROI issues when using the rocJpeg-based decoders by improving resize behavior (aspect-ratio preserving and skipping resize for images already within limits) and ensuring the fused-crop decoder reports updated ROI dimensions after applying crop parameters.
Changes:
- Replaced fixed scaling-factor downscaling with aspect-ratio-preserving fit-to-max logic in the rocJpeg decoder.
- Optimized batch decode to resize only the subset of images that exceed max dimensions (others decode directly into the output tensor).
- Updated fused-crop decoder to track and report ROI width/height after bbox/crop updates; updated resize kernel API to support subset->batch index mapping.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| rocAL/source/decoders/image/rocjpeg_fused_crop_decoder.cpp | Tracks per-image ROI after crop updates and uses it to fill actual_decoded_width/height in decode_batch(). |
| rocAL/source/decoders/image/rocjpeg_decoder.cpp | Adds aspect-ratio fit resize logic; decodes non-resized images directly to output; resizes only needed images via updated HIP kernel. |
| rocAL/rocAL_hip/rocal_hip_kernels.h | Updates resize kernel interface to accept dst_img_idx mapping for subset resize. |
| rocAL/rocAL_hip/rocal_hip_kernels.cpp | Updates resize kernels to write into the correct output image via dst_img_idx, and adds safe tail handling for RGB widths. |
| rocAL/include/decoders/image/rocjpeg_fused_crop_decoder.h | Adds ROI tracking state and initializes members defensively. |
| rocAL/include/decoders/image/rocjpeg_decoder.h | Removes scaling-factor table and adds subset index mapping buffer member. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fixes the accuracy issue with Resnet50 trainings when using rocJpeg decoder.
Fixes the ROI updation for rocJpeg fused crop decoder and also modifies the resize kernel in rocJpeg decoder to resize only the images that exceed the max decoded width and height.
Technical Details
Test Plan
All rocAL tests must pass
Test Result
Submission Checklist