nareshmlx/opencv-pr huggingface dataset:
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added

**Code Changes:**
```diff
@@ -82,6 +82,27 @@ foreach(fname ${GRADLE_WRAPPER_FILES})
   install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/gradle-wrapper/${fname}" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}/${__dir}" COMPONENT samples ${__permissions})
 endforeach()
 
+# set build.gradle namespace
+if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "7.3.0"))
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "namespace 'org.opencv'")
+else()
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "")
+endif()
```

Review comment:
What would happen if `GRADLE_VERSION` is 5.6.3?
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added

**Code Changes:**
```diff
@@ -82,6 +82,27 @@ foreach(fname ${GRADLE_WRAPPER_FILES})
   install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/gradle-wrapper/${fname}" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}/${__dir}" COMPONENT samples ${__permissions})
 endforeach()
 
+# set build.gradle namespace
+if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "7.3.0"))
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "namespace 'org.opencv'")
+else()
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "")
+endif()
```

Review comment:
Namescape came with AGP 7.3 (https://developer.android.com/build/releases/gradle-plugin) so is it okay to set minimum 7.3.0 and any higher should be fine. Any lower version basically won't use it. That include 5.6.3 or any X version lower then 7.3.0 ``` # set build.gradle namespace if(GRADLE_VERSION VERSION_GREATER_EQUAL "7.3.0") ocv_update(OPENCV_NAMESPACE_DECLARATION "namespace 'org.opencv'") else() ocv_update(OPENCV_NAMESPACE_DECLARATION "") endif() ```
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added

**Code Changes:**
```diff
@@ -82,6 +82,27 @@ foreach(fname ${GRADLE_WRAPPER_FILES})
   install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/gradle-wrapper/${fname}" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}/${__dir}" COMPONENT samples ${__permissions})
 endforeach()
 
+# set build.gradle namespace
+if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "7.3.0"))
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "namespace 'org.opencv'")
+else()
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "")
+endif()
```

Review comment:
Right, condition should use GE version check instead of strong equality.
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added

**Code Changes:**
```diff
@@ -82,6 +82,27 @@ foreach(fname ${GRADLE_WRAPPER_FILES})
   install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/gradle-wrapper/${fname}" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}/${__dir}" COMPONENT samples ${__permissions})
 endforeach()
 
+# set build.gradle namespace
+if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "7.3.0"))
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "namespace 'org.opencv'")
+else()
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "")
+endif()
```

Review comment:
Please fix whitespace issues: https://pullrequest.opencv.org/buildbot/builders/precommit_docs/builds/102951/steps/whitespace%20opencv/logs/stdio (remove extra spaces in EOL)
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added

**Code Changes:**
```diff
@@ -82,6 +82,27 @@ foreach(fname ${GRADLE_WRAPPER_FILES})
   install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/gradle-wrapper/${fname}" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}/${__dir}" COMPONENT samples ${__permissions})
 endforeach()
 
+# set build.gradle namespace
+if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "7.3.0"))
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "namespace 'org.opencv'")
+else()
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "")
+endif()
```

Review comment:
Did you mean this ? if(GRADLE_VERSION VERSION_GREATER "7.2.9").
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added

**Code Changes:**
```diff
@@ -82,6 +82,27 @@ foreach(fname ${GRADLE_WRAPPER_FILES})
   install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/gradle-wrapper/${fname}" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}/${__dir}" COMPONENT samples ${__permissions})
 endforeach()
 
+# set build.gradle namespace
+if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "7.3.0"))
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "namespace 'org.opencv'")
+else()
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "")
+endif()
```

Review comment:
I didn't see it, it is done.
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added

**Code Changes:**
```diff
@@ -82,6 +82,27 @@ foreach(fname ${GRADLE_WRAPPER_FILES})
   install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/gradle-wrapper/${fname}" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}/${__dir}" COMPONENT samples ${__permissions})
 endforeach()
 
+# set build.gradle namespace
+if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "7.3.0"))
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "namespace 'org.opencv'")
+else()
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "")
+endif()
```

Review comment:
Both cases should do the similar thing: ``` if(GRADLE_VERSION VERSION_GREATER_EQUAL "7.3.0") if(GRADLE_VERSION VERSION_GREATER "7.2.9") ``` The first option is clear however. --- BTW, "gradle plugin version" is not the same as "gradle version". Plugin version is specified through `ANDROID_GRADLE_PLUGIN_VERSION`
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added

**Code Changes:**
```diff
@@ -82,6 +82,27 @@ foreach(fname ${GRADLE_WRAPPER_FILES})
   install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/gradle-wrapper/${fname}" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}/${__dir}" COMPONENT samples ${__permissions})
 endforeach()
 
+# set build.gradle namespace
+if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "7.3.0"))
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "namespace 'org.opencv'")
+else()
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "")
+endif()
```

Review comment:
I changed with AGP and push it.
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added

**Code Changes:**
```diff
@@ -82,6 +82,27 @@ foreach(fname ${GRADLE_WRAPPER_FILES})
   install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/gradle-wrapper/${fname}" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}/${__dir}" COMPONENT samples ${__permissions})
 endforeach()
 
+# set build.gradle namespace
+if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "7.3.0"))
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "namespace 'org.opencv'")
+else()
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "")
+endif()
```

Review comment:
> VERSION_GREATER_EQUAL Some old CMake versions doesn't support that. Please use check in this form: ``` if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "7.3.0")) ```
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added

**Code Changes:**
```diff
@@ -82,6 +82,27 @@ foreach(fname ${GRADLE_WRAPPER_FILES})
   install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/gradle-wrapper/${fname}" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}/${__dir}" COMPONENT samples ${__permissions})
 endforeach()
 
+# set build.gradle namespace
+if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "7.3.0"))
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "namespace 'org.opencv'")
+else()
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "")
+endif()
```

Review comment:
`OPENCV_NAMESPACE_DECLARATION` -> `OPENCV_ANDROID_NAMESPACE_DECLARATION` is preferable to avoid possible conflicts.
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added

**Code Changes:**
```diff
@@ -82,6 +82,27 @@ foreach(fname ${GRADLE_WRAPPER_FILES})
   install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/gradle-wrapper/${fname}" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}/${__dir}" COMPONENT samples ${__permissions})
 endforeach()
 
+# set build.gradle namespace
+if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "7.3.0"))
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "namespace 'org.opencv'")
+else()
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "")
+endif()
```

Review comment:
`ocv_update(ANDROID_GRADLE_JAVA_VERSION "17")` below would not work after that (there is "no op" logic if value exists for the variable) We could use it in this form (condition check should go first) - see `_INIT` suffix: ``` # set android gradle java version in build.gradle if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "8.0.0")) # AGP-8.0 requires a minimum JDK version of JDK17 ocv_update(ANDROID_GRADLE_JAVA_VERSION_INIT "17") else() ocv_update(ANDROID_GRADLE_JAVA_VERSION_INIT "1_8") endif() set(ANDROID_GRADLE_JAVA_VERSION "${ANDROID_GRADLE_JAVA_VERSION_INIT}" CACHE STRING "Android Gradle Java version") message(STATUS "Android Gradle Java version: ${ANDROID_GRADLE_JAVA_VERSION}") ```
**File:** cmake/android/android_gradle_projects.cmake
**Change Type:** modified
**Context:** PR #23447: AGP 8.0 build.gradle namespace and aidl buildFeature requirement added

**Code Changes:**
```diff
@@ -82,6 +82,27 @@ foreach(fname ${GRADLE_WRAPPER_FILES})
   install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/gradle-wrapper/${fname}" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}/${__dir}" COMPONENT samples ${__permissions})
 endforeach()
 
+# set build.gradle namespace
+if(NOT (ANDROID_GRADLE_PLUGIN_VERSION VERSION_LESS "7.3.0"))
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "namespace 'org.opencv'")
+else()
+  ocv_update(OPENCV_ANDROID_NAMESPACE_DECLARATION "")
+endif()
```

Review comment:
I pushed the changes
**File:** modules/core/include/opencv2/core/cvdef.h
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 970

**Code Changes:**
```diff
 
@@ -963,6 +967,41 @@ class float16_t
 #endif
 };
 
+class bfloat16_t
+{
+public:
+    bfloat16_t() : w(0) {}
+    explicit bfloat16_t(float x)
+    {
```

Review comment:
It can conflict with C++23 floating-point types: https://en.cppreference.com/w/cpp/types/floating-point , though the same issue can be seen with the `float16_t`.
**File:** modules/calib/test/test_multiview_calib.cpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 86

**Code Changes:**
```diff
@@ -83,7 +83,7 @@ TEST(multiview_calibration, accuracy) {
         cv::Mat pattern_new = (R * (pattern - centroid * ones) + centroid * ones  + t * ones).t();
 
         std::vector<cv::Mat> img_pts_cams(num_cameras);
-        std::vector<bool> visible(num_cameras, false);
+        std::vector<uchar> visible(num_cameras, (uchar)0);
         int num_visible_patterns = 0;
         for (int c = 0; c < num_cameras; c++) {
             cv::Mat img_pts;
@@ -108,7 +108,7 @@ TEST(multiview_calibration, accuracy) {
                 }
```

Review comment:
why? where is it used with OpenCV API?
**File:** modules/core/include/opencv2/core/hal/interface.h
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 82

**Code Changes:**
```diff
@@ -78,9 +78,17 @@ typedef signed char schar;
 #define CV_32F  5
 #define CV_64F  6
 #define CV_16F  7
+#define CV_16BF 8
+#define CV_Bool 9
+#define CV_64U  10
+#define CV_64S  11
+#define CV_32U  12
+#define CV_DEPTH_CURR_MAX 13
 
```

Review comment:
all uppercase. P.S. Put `#undef` in GAPI header. Finally we should drop defines and start using of C++ enums.
**File:** modules/core/include/opencv2/core/cvdef.h
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat

**Code Changes:**
```diff
@@ -487,9 +487,13 @@ Cv64suf;
 #define CV_SUBMAT_FLAG          (1 << CV_SUBMAT_FLAG_SHIFT)
 #define CV_IS_SUBMAT(flags)     ((flags) & CV_MAT_SUBMAT_FLAG)
 
-/** Size of each channel item,
-   0x28442211 = 0010 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */
-#define CV_ELEM_SIZE1(type) ((0x28442211 >> CV_MAT_DEPTH(type)*4) & 15)
+/** Size of an array/scalar single-channel value, 4 bits per type:
+    CV_8U - 1 byte
+    CV_8S - 1 byte
```

Review comment:
`CV_MAT_DEPTH(type) * 4` => `(CV_MAT_DEPTH(type) * 4)`
**File:** modules/core/include/opencv2/core/hal/intrin.hpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 1115

**Code Changes:**
```diff
@@ -1095,6 +1111,10 @@ namespace CV__SIMD_NAMESPACE {
 #define CV_SIMD 0
 #endif
 
+#if (!defined CV_SIMD_64F) || (!CV_SIMD_64F)
+typedef struct v_float64 { int dummy; } v_float64;
+#endif
+
 #include "simd_utils.impl.hpp"
 
 #ifndef CV_DOXYGEN
```

Review comment:
It is better to drop this hack, If we don't have type support, then we don't declare type itself.
**File:** modules/core/include/opencv2/core/hal/intrin_avx.hpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 943

**Code Changes:**
```diff
     { return ~(a == b); }
 
+inline v_int64x4 operator > (const v_int64x4& a, const v_int64x4& b)
+{ return v_int64x4(_mm256_cmpgt_epi64(a.val, b.val)); }
+inline v_int64x4 operator < (const v_int64x4& a, const v_int64x4& b)
+{ return v_int64x4(_mm256_cmpgt_epi64(b.val, a.val)); }
+
 OPENCV_HAL_IMPL_AVX_CMP_OP_64BIT(v_uint64x4)
 OPENCV_HAL_IMPL_AVX_CMP_OP_64BIT(v_int64x4)
 
@@ -3162,6 +3167,22 @@ inline void v_pack_store(float16_t* ptr, const v_float32x8& a)
```

Review comment:
Adding of new intrinsic functions requires modification of C++ reference code / documentation and adding new tests.
**File:** modules/core/include/opencv2/core/mat.inl.hpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 670

**Code Changes:**
```diff
 {
-    size_t res = dims > 0 ? step.p[dims - 1] : 0;
-    CV_DbgAssert(res != 0);
-    return res;
+    return CV_ELEM_SIZE(flags);
 }
 
 inline
```

Review comment:
We should not allow asking for size of empty/released/non-defined Mat.
**File:** modules/core/include/opencv2/core/saturate.hpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 158

**Code Changes:**
```diff
 template<> inline uint64 saturate_cast<uint64>(short v)      { return (uint64)std::max(v, (short)0); }
 template<> inline uint64 saturate_cast<uint64>(int v)        { return (uint64)std::max(v, (int)0); }
 template<> inline uint64 saturate_cast<uint64>(int64 v)      { return (uint64)std::max(v, (int64)0); }
 
 template<> inline int64 saturate_cast<int64>(uint64 v)       { return (int64)std::min(v, (uint64)LLONG_MAX); }
+template<> inline int64 saturate_cast<int64>(float v)        { return (int64)round((double)v); }
+template<> inline int64 saturate_cast<int64>(double v)       { return (int64)round(v); }
+template<> inline uint64 saturate_cast<uint64>(float v)      { return (int64)round((double)std::max(v, 0.f)); }
+template<> inline uint64 saturate_cast<uint64>(double v)     { return (int64)round(std::max(v, 0.)); }
+
 
```

Review comment:
why double?
**File:** modules/core/src/persistence.cpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 1152

**Code Changes:**
```diff
                     case CV_32S:
                         ptr = fs::itoa(*(int *) data, buf, 10);
                         data += sizeof(int);
                         break;
+                    case CV_64U:
+                        ptr = fs::itoa(*(uint64_t*) data, buf, 10, false);
+                        data += sizeof(uint64_t);
+                        break;
+                    case CV_64S:
+                        ptr = fs::itoa(*(int64_t*) data, buf, 10, true);
+                        data += sizeof(int64_t);
```

Review comment:
What implementation supports `uint64_t`?
**File:** modules/core/src/persistence.cpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat

**Code Changes:**
```diff
@@ -56,6 +56,28 @@ char* itoa( int _val, char* buffer, int /*radix*/ )
     return ptr;
 }
 
+char* itoa( int64_t _val, char* buffer, int /*radix*/, bool _signed)
+{
+    const int radix = 10;
+    char* ptr=buffer + 23 /* enough even for 64-bit integers */;
+    int sign = _signed && _val < 0 ? -1 : 1;
+    uint64_t val = !_signed ? (uint64_t)_val : abs(_val);
```

Review comment:
does it really work? condition is wrong It is better to have different overloads instead.
**File:** modules/core/test/test_io.cpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 1909

**Code Changes:**
```diff
     EXPECT_EQ(CV_16FC3, m16fc3.type()) << typeToString(m16fc3.type());
     //std::cout << m16fc3 << std::endl;
 
+    Mat m16bfc1, m16bfc3;
+    m16fc1.convertTo(m16bfc1, CV_16BF);
+    m16fc3.convertTo(m16bfc3, CV_16BF);
+
     fs << "m16fc1" << m16fc1;
     fs << "m16fc3" << m16fc3;
+    fs << "m16bfc1" << m16bfc1;
+    fs << "m16bfc3" << m16bfc3;
```

Review comment:
> test_20279 It is better to write own test function instead of hijacking of existed one.
**File:** modules/videoio/src/backend_plugin.cpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 542

**Code Changes:**
```diff
             return CV_ERROR_FAIL;
+        int depth = CV_MAT_DEPTH(type);
+        // [TODO] Remove this condition after rebuilding plugins or add a new
+        // version of plugins. Convert type from the old one to the new one (5 bits)
+        if (depth > 7) {
+            type = CV_MAKETYPE((type & 7), (type >> 3) + 1);
+        }
         cv::Mat(cv::Size(width, height), type, (void*)data, step).copyTo(*dst);
         return CV_ERROR_OK;
     }
```

Review comment:
It is time to drop hack on the line 148 of this file.
**File:** modules/calib/test/test_multiview_calib.cpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 86

**Code Changes:**
```diff
@@ -83,7 +83,7 @@ TEST(multiview_calibration, accuracy) {
         cv::Mat pattern_new = (R * (pattern - centroid * ones) + centroid * ones  + t * ones).t();
 
         std::vector<cv::Mat> img_pts_cams(num_cameras);
-        std::vector<bool> visible(num_cameras, false);
+        std::vector<uchar> visible(num_cameras, (uchar)0);
         int num_visible_patterns = 0;
         for (int c = 0; c < num_cameras; c++) {
             cv::Mat img_pts;
@@ -108,7 +108,7 @@ TEST(multiview_calibration, accuracy) {
                 }
```

Review comment:
the change makes the test pass
**File:** modules/core/include/opencv2/core/hal/interface.h
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 82

**Code Changes:**
```diff
@@ -78,9 +78,17 @@ typedef signed char schar;
 #define CV_32F  5
 #define CV_64F  6
 #define CV_16F  7
+#define CV_16BF 8
+#define CV_Bool 9
+#define CV_64U  10
+#define CV_64S  11
+#define CV_32U  12
+#define CV_DEPTH_CURR_MAX 13
 
```

Review comment:
postpone it till the next patch
**File:** modules/core/include/opencv2/core/cvdef.h
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat

**Code Changes:**
```diff
@@ -487,9 +487,13 @@ Cv64suf;
 #define CV_SUBMAT_FLAG          (1 << CV_SUBMAT_FLAG_SHIFT)
 #define CV_IS_SUBMAT(flags)     ((flags) & CV_MAT_SUBMAT_FLAG)
 
-/** Size of each channel item,
-   0x28442211 = 0010 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */
-#define CV_ELEM_SIZE1(type) ((0x28442211 >> CV_MAT_DEPTH(type)*4) & 15)
+/** Size of an array/scalar single-channel value, 4 bits per type:
+    CV_8U - 1 byte
+    CV_8S - 1 byte
```

Review comment:
so far there is no warning
**File:** modules/core/include/opencv2/core/hal/intrin.hpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 1115

**Code Changes:**
```diff
@@ -1095,6 +1111,10 @@ namespace CV__SIMD_NAMESPACE {
 #define CV_SIMD 0
 #endif
 
+#if (!defined CV_SIMD_64F) || (!CV_SIMD_64F)
+typedef struct v_float64 { int dummy; } v_float64;
+#endif
+
 #include "simd_utils.impl.hpp"
 
 #ifndef CV_DOXYGEN
```

Review comment:
disagree; v_float64 and the relevant ops should always be available. CV_SIMD_64F and code fragmentation was a bad idea
**File:** modules/core/include/opencv2/core/saturate.hpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 158

**Code Changes:**
```diff
 template<> inline uint64 saturate_cast<uint64>(short v)      { return (uint64)std::max(v, (short)0); }
 template<> inline uint64 saturate_cast<uint64>(int v)        { return (uint64)std::max(v, (int)0); }
 template<> inline uint64 saturate_cast<uint64>(int64 v)      { return (uint64)std::max(v, (int64)0); }
 
 template<> inline int64 saturate_cast<int64>(uint64 v)       { return (int64)std::min(v, (uint64)LLONG_MAX); }
+template<> inline int64 saturate_cast<int64>(float v)        { return (int64)round((double)v); }
+template<> inline int64 saturate_cast<int64>(double v)       { return (int64)round(v); }
+template<> inline uint64 saturate_cast<uint64>(float v)      { return (int64)round((double)std::max(v, 0.f)); }
+template<> inline uint64 saturate_cast<uint64>(double v)     { return (int64)round(std::max(v, 0.)); }
+
 
```

Review comment:
need to experiment, maybe (int64)round(v) would give the same results for numbers outside of [INT_MIN, INT_MAX] range.
**File:** modules/core/include/opencv2/core/saturate.hpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 202

**Code Changes:**
```diff
+template<> inline bool saturate_cast<bool>(ushort v) { return v != 0; }
+template<> inline bool saturate_cast<bool>(short v) { return v != 0; }
+template<> inline bool saturate_cast<bool>(unsigned v){ return v != 0; }
+template<> inline bool saturate_cast<bool>(int v){ return v != 0; }
+template<> inline bool saturate_cast<bool>(float v){ return v != 0; }
+template<> inline bool saturate_cast<bool>(double v){ return v != 0; }
+template<> inline bool saturate_cast<bool>(uint64_t v){ return v != 0; }
+template<> inline bool saturate_cast<bool>(int64_t v){ return v != 0; }
+template<> inline bool saturate_cast<bool>(float16_t v){ return (float)v != 0; }
+template<> inline bool saturate_cast<bool>(bfloat16_t v){ return (float)v != 0; }
 
```

Review comment:
+0/-0 ~ false, NaN ~ ???, other numbers ~ true.
**File:** modules/core/src/persistence.cpp
**Change Type:** modified
**Context:** PR #23865: Added new data types to cv::Mat & UMat
**Review Line:** 1152

**Code Changes:**
```diff
                     case CV_32S:
                         ptr = fs::itoa(*(int *) data, buf, 10);
                         data += sizeof(int);
                         break;
+                    case CV_64U:
+                        ptr = fs::itoa(*(uint64_t*) data, buf, 10, false);
+                        data += sizeof(uint64_t);
+                        break;
+                    case CV_64S:
+                        ptr = fs::itoa(*(int64_t*) data, buf, 10, true);
+                        data += sizeof(int64_t);
```

Review comment:
there is overload