Skip to content

RPP Median Filter and Gaussian Optimizations#561

Merged
r-abishek merged 9 commits intor-abishek:ar/opt_median_gaussian_filterfrom
HazarathKumarM:hk/median_filter_opts
Feb 27, 2026
Merged

RPP Median Filter and Gaussian Optimizations#561
r-abishek merged 9 commits intor-abishek:ar/opt_median_gaussian_filterfrom
HazarathKumarM:hk/median_filter_opts

Conversation

@HazarathKumarM
Copy link
Copy Markdown
Collaborator

@HazarathKumarM HazarathKumarM commented Feb 16, 2026

  • Optimized Median filter and gaussian filter code to match the performance with opencv

image image

image image

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 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.

@HazarathKumarM HazarathKumarM changed the title RPP Median Filter Optimizations RPP Median Filter and Gaussian Optimizations Feb 27, 2026
@r-abishek r-abishek changed the base branch from develop to ar/opt_median_gaussian_filter February 27, 2026 06:04
@r-abishek r-abishek merged commit ab67f51 into r-abishek:ar/opt_median_gaussian_filter Feb 27, 2026
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