Files
opencv-MIRROR/modules
gupengzu 148d007185 Parallelize calcHist using thread-local histograms
Add a calcHistRunParallel wrapper that splits the input image across
threads, each accumulating into a private histogram, then sums the
local copies at the end. This avoids atomic contention on shared bins.

The thread count follows the suggestion from PR #28635 review:
- if N < 256K elements, use a single thread
- otherwise nstripes = clamp(cvRound(N*0.001/M), 1, 8),
  where M is the total number of histogram bins
- nstripes is further capped by getNumThreads(), so setNumThreads(0)
  and setNumThreads(1) keep the single-histogram path

This keeps large histograms (e.g. 2D 256x256) single-threaded to avoid
excessive memory, while small histograms (e.g. 1D 256 bins) on large
images get up to 8x parallelism.

Performance (1920x1080, 8 threads, median of 20 runs):
- 8U 1D:  0.62ms -> 0.17ms  (3.7x)
- 16U 1D: 3.81ms -> 0.95ms  (4.0x)
- 32F 1D: 3.62ms -> 0.37ms  (9.7x)

Adds a parameterized consistency test verifying that results match a
row-by-row single-threaded baseline bit-exactly across 8U/16U/32F,
1D-3D and various image sizes. Both stripe-splitting branches are
covered: a non-contiguous ROI takes the row-split path, a contiguous
clone takes the column-split path. A 1D mask bypasses IPP/HAL.
2026-10-24 11:17:34 +08:00
..
2026-10-23 14:28:38 +03:00
2026-10-23 14:28:38 +03:00
2026-07-09 12:17:24 +03:00
2026-10-23 14:28:38 +03:00
2026-08-19 17:38:39 +02:00