RPP Median Filter and Gaussian Optimizations#561
Merged
r-abishek merged 9 commits intor-abishek:ar/opt_median_gaussian_filterfrom Feb 27, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request optimizes the median filter implementation to match OpenCV performance by introducing sorting networks, AVX2 SIMD vectorization, and histogram-based methods for different kernel sizes and data types.
Changes:
- Implemented optimized sorting networks for 3×3 and 5×5 median filters on both CPU (with AVX2) and HIP GPU
- Added histogram-based O(1) median computation for large kernels (7×7, 9×9) on U8 data types
- Refactored the compute_median and median_filter_row_hip_compute functions in HIP to support multiple algorithms based on kernel size and data type
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| src/modules/tensor/hip/kernel/median_filter.cpp | Added optimized 5×5 sorting network function, refactored compute_median with histogram method for large kernels, updated median_filter_row_hip_compute to handle float vs integer types separately, fixed double semicolon typo |
| src/modules/tensor/cpu/kernel/median_filter.cpp | Added AVX2 SIMD implementations for 3×3 and 5×5 kernels across multiple data types (U8, I8, F32, F16), implemented histogram-based method for large kernels, added scalar sorting network fallback functions, refactored main function with algorithm selection logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
r-abishek
approved these changes
Feb 27, 2026
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.
Uh oh!
There was an error while loading. Please reload this page.