shivensolanki
413798a1b4
core: fix NORM_L2 overflow for CV_16S and CV_32S at the type minimum
...
The SIMD kernels of cv::norm(src, NORM_L2/NORM_L2SQR) for CV_16S and CV_32S
sum adjacent squares in a type that is too narrow for the most negative value:
- CV_16S: the int16 dot product accumulates pairs in int32, and
(-32768)^2 + (-32768)^2 = 2^31 wraps to INT_MIN.
- CV_32S: the int32 dot product accumulates pairs in int64, and
INT_MIN^2 + INT_MIN^2 = 2^63 wraps to INT64_MIN.
As a result NORM_L2SQR could return a negative value and NORM_L2 NaN, but
only for inputs long enough to reach the vector loop. Masked norm and
norm(src1, src2) were not affected.
Widen the int16 pairwise sums as unsigned (they always fit into uint32) and
square int32 values in double. Performance is unchanged.
2026-10-20 03:31:31 +00:00
..
2025-09-01 13:25:50 +03:00
2026-05-07 09:18:29 +08:00
2025-09-19 03:25:40 +00:00
2026-06-28 14:20:45 +03:00
2022-12-16 00:47:44 +00:00
2024-03-05 12:15:39 +03:00
2026-03-02 01:47:14 -08:00
2025-11-10 08:00:17 +03:00
2023-10-06 13:33:21 +03:00
2026-08-03 14:51:35 +08:00
2026-06-10 13:11:27 +03:00
2024-01-19 16:53:08 +03:00
2024-03-05 12:15:39 +03:00
2025-01-10 15:02:18 +03:00
2022-07-24 11:58:17 +03:00
2018-09-07 20:33:52 +09:00
2026-07-20 10:21:00 +08:00
2024-08-09 14:22:02 +03:00
2024-03-05 12:15:39 +03:00
2018-07-04 19:11:29 +03:00
2026-03-13 22:25:08 +05:30
2023-04-26 09:48:15 -04:00
2025-03-04 16:49:59 +03:00
2025-11-10 08:00:17 +03:00
2024-03-21 23:44:19 +03:00
2025-04-07 14:18:37 +03:00
2026-08-20 11:30:09 +08:00
2023-04-21 10:55:04 +03:00
2026-06-25 08:43:27 +00:00
2024-12-17 17:26:14 +03:00
2024-08-01 10:00:31 +02:00
2019-03-05 14:47:04 +03:00
2025-08-11 12:15:24 +03:00
2023-05-22 11:02:04 +03:00
2024-03-05 12:15:39 +03:00
2022-03-03 07:21:53 +09:00
2019-03-24 18:34:09 +03:00
2019-12-27 12:46:53 +00:00
2026-08-23 12:29:49 +05:30
2018-04-24 16:03:40 +03:00
2013-03-22 14:03:15 +04:00
2026-09-21 18:07:13 +03:00
2026-07-07 15:20:09 +03:00
2021-02-16 11:10:45 +00:00
2025-10-16 21:19:12 +09:00
2023-06-09 13:37:20 +03:00
2024-05-17 10:48:40 +03:00
2021-09-10 12:10:41 +00:00
2025-09-23 15:48:10 +03:00
2026-08-14 15:56:30 +00:00
2026-08-21 15:26:24 +03:00
2019-04-01 18:11:55 +03:00
2025-03-30 16:17:07 +03:00
2023-06-20 09:56:57 +03:00
2026-06-18 17:29:18 +03:00
2026-08-12 18:10:38 +05:30
2026-06-18 17:29:18 +03:00
2026-06-15 21:53:10 +03:00
2026-06-17 11:50:58 +03:00
2026-09-11 15:33:26 +03:00
2018-08-08 17:54:54 +03:00
2026-10-13 20:42:48 -07:00
2026-10-06 09:45:39 +08:00
2024-03-05 12:15:39 +03:00
2018-09-14 06:45:31 +09:00
2026-07-06 17:11:51 +03:00
2021-02-16 11:10:45 +00:00
2026-07-15 22:36:29 +03:00
2025-01-13 16:34:28 +01:00
2026-10-06 12:07:58 +03:00
2026-09-20 20:35:14 -07:00
2026-03-30 10:48:00 +02:00
2025-03-24 09:21:22 +03:00
2026-06-23 13:13:15 +03:00
2024-05-17 10:48:40 +03:00
2023-08-11 08:33:33 +03:00
2026-06-18 16:33:50 +00:00
2026-06-25 15:51:33 +03:00
2026-07-01 15:48:47 +03:00
2026-10-20 03:31:31 +00:00
2024-01-26 12:56:52 +03:00
2025-08-15 01:17:54 +02:00
2026-06-10 20:26:55 +03:00
2024-03-21 23:44:19 +03:00
2020-01-06 06:32:56 +03:00
2026-02-18 04:35:41 +08:00
2018-01-26 04:09:11 +00:00
2026-08-31 16:23:26 +05:30
2018-09-14 06:45:31 +09:00
2026-06-16 18:51:37 +03:00
2023-10-06 13:33:21 +03:00
2024-11-11 14:13:33 +03:00
2025-07-29 12:04:55 +03:00
2026-06-16 18:51:37 +03:00
2024-11-11 14:13:33 +03:00
2026-03-12 10:37:24 +03:00
2026-06-23 15:38:59 +03:00
2025-01-13 16:34:28 +01:00
2023-04-28 20:42:52 +03:00
2024-10-08 15:55:00 +03:00
2026-07-15 22:36:29 +03:00
2026-07-15 22:36:29 +03:00
2026-07-15 22:36:29 +03:00
2026-07-15 22:36:29 +03:00
2026-07-15 22:36:29 +03:00
2026-07-15 22:36:29 +03:00
2026-07-15 22:36:29 +03:00
2023-10-06 13:33:21 +03:00
2024-05-17 10:48:40 +03:00
2023-10-06 13:33:21 +03:00
2021-03-02 23:24:28 +00:00
2026-07-01 15:48:47 +03:00
2018-02-12 14:14:08 +03:00
2026-07-01 15:48:47 +03:00
2018-08-27 14:42:18 +03:00
2025-05-23 12:35:11 +03:00
2024-05-17 10:48:40 +03:00
2026-10-18 01:19:58 -04:00
2014-08-15 12:09:16 +04:00
2022-05-13 17:32:05 +00:00
2026-09-07 21:44:04 -07:00
2026-05-07 09:18:29 +08:00
2018-01-16 17:33:06 +03:00
2022-01-31 17:12:37 -05:00
2024-10-30 18:37:22 +03:00