diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h index d94d96a925..abacc930bc 100644 --- a/modules/core/include/opencv2/core/cvdef.h +++ b/modules/core/include/opencv2/core/cvdef.h @@ -521,10 +521,11 @@ Cv64suf; CV_16U - 2 bytes ... */ +// '& 15' == '- 16' for depth in [16,31] here, but avoids a spurious MSVC C4293 on this ternary. #define CV_ELEM_SIZE1(type) \ ((int)((CV_MAT_DEPTH(type) < 16 \ - ? (0x1114881228442211ULL >> (CV_MAT_DEPTH(type) * 4)) \ - : (0x0000000000000001ULL >> ((CV_MAT_DEPTH(type) - 16) * 4))) & 15)) + ? (0x1114881228442211ULL >> ((CV_MAT_DEPTH(type) & 15) * 4)) \ + : (0x0000000000000001ULL >> ((CV_MAT_DEPTH(type) & 15) * 4))) & 15)) #define CV_ELEM_SIZE(type) (CV_MAT_CN(type)*CV_ELEM_SIZE1(type)) diff --git a/modules/geometry/perf/perf_pnp.cpp b/modules/geometry/perf/perf_pnp.cpp index f41e95efba..302d364601 100644 --- a/modules/geometry/perf/perf_pnp.cpp +++ b/modules/geometry/perf/perf_pnp.cpp @@ -54,8 +54,9 @@ PERF_TEST_P(PointsNum_Algo, solvePnP, } SANITY_CHECK(rvec, 1e-4); - // the check is relaxed from 1e-4 to 2e-2 after LevMarq replacement - SANITY_CHECK(tvec, 2e-2); + // the check is relaxed from 1e-4 to 2e-2 after LevMarq replacement (#21018), + // then to 3e-2 after the cv::Mat broadcasting element-wise engine rewrite (#29426) + SANITY_CHECK(tvec, 3e-2); } PERF_TEST_P(PointsNum_Algo, solvePnPSmallPoints,