Skip to content

fix(rpp): Validate fisheye HOST source coordinates in the ROI-local frame - #13941

Merged
LakshmiKumar23 merged 1 commit into
developfrom
users/sruthi0107/fisheye-host-roi-frame
Oct 27, 2026
Merged

LakshmiKumar23 merged 1 commit into
developfrom
users/sruthi0107/fisheye-host-roi-frame

Conversation

@sruthi0107

Copy link
Copy Markdown
Contributor

Motivation

When fisheye ran on the CPU with an ROI that does not start at the image origin, a large part of the output came back black. On a 24x18 ROI at offset (12, 9), 1408 of 2592 output values were wrong. The GPU path and full-image ROIs were correct; only CPU partial ROIs were affected.

Issue

JIRA ID: AICV-260

Technical Details

The CPU kernel computes the source coordinate relative to the ROI and reads from a pointer already moved to the ROI origin, which is consistent. But it checked that coordinate against the ROI's absolute bounds (x0..x0+w-1, y0..y0+h-1). Every coordinate left of x0 or above y0 was rejected and written as black, and coordinates up to x0+w-1 were accepted even though the ROI ends at w-1 in that frame.

Validate against the ROI in the same frame the coordinate is in: (0, 0, w-1, h-1). A new compute_fisheye_roi_ltrb_local replaces compute_ltrb_from_xywh_host in the U8, F16, F32 and I8 kernels. The shared nearest-neighbor helpers are unchanged; warp_affine and warp_perspective use them with absolute coordinates and are correct.

Test Plan

Ran the fisheye correctness tests from the GoogleTest suite (#11802) with the skip list disabled, against develop and against this branch:

RPP_TEST_NO_SKIP_LIST=1 rpp_tests --gtest_filter='*FisheyeTest*'

Compared CPU against GPU output for all four data types (the suite does not cover I8), three layouts and four ROI placements. Ran the full suite, both normal and with the skip list disabled, to check for regressions.

Test Result

Test Before After
U8 PKD3 partial ROI, row 1 col 7, golden 96 0 (blacked) 96 PASS
CPU fisheye partial-ROI tests 0/30 30/30 PASS
CPU vs GPU, U8/I8/F16/F32, partial ROIs (differing elements) 23106 0 PASS
Full suite, normal mode 15889 OK, 0 FAILED 15889 OK, 0 FAILED
Full suite, skip list disabled 8601 failing 8570 failing, 0 new failures

…rame

compute_fisheye_src_loc returns a coordinate relative to the ROI
(srcX in [0, roiWidth)), and srcPtrChannel is already advanced to the
ROI origin, so the load is correct. The bounds check, however, used the
absolute ROI rectangle from compute_ltrb_from_xywh_host
(x0..x0+w-1, y0..y0+h-1). With a non-zero ROI offset, every mapped
pixel left of x0 or above y0 was written black, and pixels past the
ROI's local right/bottom edge were accepted. Full-image ROIs were
unaffected because the two frames coincide; HIP adds the ROI origin to
the coordinate and was already correct.

Validate against (0, 0, roiWidth - 1, roiHeight - 1) instead, via a new
compute_fisheye_roi_ltrb_local, in the U8, F16, F32 and I8 kernels. The
shared nearest-neighbor helpers are unchanged: warp_affine and
warp_perspective pass absolute coordinates from the image base and are
correct.
@therock-pr-bot

therock-pr-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/rpp/src/modules/tensor/cpu/kernel/fisheye.cpp; no test file found
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —
🤖 therock-pr-bot ✅ Pass —

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The localized change consistently corrects the coordinate-frame mismatch while preserving origin-aligned ROI behavior, with no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes blacked-out output in CPU fisheye operations with offset regions of interest (ROIs) by validating source coordinates against ROI-local bounds.

Changes:

  • Adds a fisheye-specific helper that computes bounds from (0, 0) to (width−1, height−1).
  • Applies the helper to U8, F16, F32, and I8 CPU kernels without changing shared nearest-neighbor helpers.
File Description
projects/​rpp/​src/​modules/​tensor/​cpu/​kernel/​fisheye.cpp Aligns fisheye validation bounds with ROI-local source coordinates across all four data types.

Review effort: Balanced

@LakshmiKumar23
LakshmiKumar23 merged commit 2adf5da into develop Oct 27, 2026
109 checks passed
@LakshmiKumar23
LakshmiKumar23 deleted the users/sruthi0107/fisheye-host-roi-frame branch October 27, 2026 22:30
@assistant-librarian

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants