Files
opencv-MIRROR/modules/core/include
Shiven Solanki 76bae0c542 core: support CV_16F and CV_16BF in finiteMask (#30620)
* core: support CV_16F and CV_16BF in finiteMask

finiteMask asserted CV_32F or CV_64F input, so 16-bit float arrays,
which can hold NaN and infinity too, could not be checked.

Add finiteMask16_, which marks a pixel as finite if no channel has an
all-ones exponent (0x7c00 for CV_16F, 0x7f80 for CV_16BF), for 1 to 4
channels. getFiniteMaskFunc now takes the depth. The OpenCL kernel only
handles float and double, so other depths fall back to the CPU path.

* core: use SIMD and typed templates in 16-bit finiteMask

Use hfloat and bfloat as the template parameter of finiteMask16_ instead
of the raw exponent masks, and add a universal-intrinsics path for 1 to
4 channels.

Add Core_FiniteMask_bits, which checks exact bit patterns at the edges
of the exponent: largest finite, subnormal, signalling, quiet and
negative NaN, and both infinities.

* core: use the scalar loop for 1-channel 16-bit finiteMask

With 1 channel, the compiler vectorizes the scalar loop, and it runs
faster than the explicit SIMD path. Use the SIMD path only for 2 to 4
channels.
2026-11-13 15:36:54 +05:30
..