Files
opencv-MIRROR/modules/imgproc
Madan mohan Manokar 9dae03b6a5 imgproc: fix RGB2Gray tail for overlapping buffers (4.x) (#30981)
* imgproc: fix RGB2Gray tail for overlapping buffers

The vector kernels cover a remainder by rewinding the final block, which re-reads source pixels. An overlapping destination can overwrite those bytes before the re-read.

Take the AVX-512 kernels only when the source and destination byte ranges are disjoint, and finish an overlapping remainder with the scalar loop. Use 'i <= n - 16' so the loop check cannot overflow for very large rows.

* imgproc: apply disjoint check to all gray conversion tails

- Add rgbRowsDisjoint() helper (byte ranges) shared by the gray kernels
- RGB2Gray (float, ushort, uchar) and RGB5x52Gray rewind the final block
  only when src/dst are disjoint, replacing the ineffective src == dst
- Document that overlapping conversion is supported only for dst <= src
- Add regression tests converting into a header aliasing the source for
  BGR(A)2GRAY (8U/16U/32F) and BGR565/555 2GRAY, widths 1..100

* imgproc: use shared RNG and drop no-op IPP toggle in gray alias tests

- checkGrayDstAliasesSrc: use theRNG() instead of a fixed-seed local RNG
- rgb5x52gray_dst_aliases_src: remove IPP toggle (no IPP HAL for cvtBGR5x5toGray)
2026-12-01 13:16:14 +05:30
..
2025-03-19 21:38:08 +05:30