nareshmlx/opencv-pr huggingface dataset:
**File:** modules/gapi/include/opencv2/gapi/infer/ie.hpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -8,6 +8,7 @@
 #define OPENCV_GAPI_INFER_IE_HPP
 
 #include <unordered_map>
+#include <unordered_set>
 #include <string>
 #include <array>
 #include <tuple> // tuple, tuple_size
@@ -68,6 +69,9 @@ namespace detail {
         bool is_generic;
```

Review comment:
So, it isn't reflected in PR description.
**File:** modules/gapi/include/opencv2/gapi/infer/ie.hpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.
**Review Line:** 114

**Code Changes:**
```diff
     };
 
@@ -106,6 +112,8 @@ template<typename Net> class Params {
               , detail::ParamDesc::Kind::Import
               , false
               , {}
+              , {}
+              , {}
               , 1u} {
     };
 
```

Review comment:
false - `is_generic` { } - `config` { } - `reshape_in_shapes` Where is initialization for `reshape_in_names` ?
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.
**Review Line:** 229

**Code Changes:**
```diff
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
             inputs  = cv::gimpl::ie::wrap::toInputsDataMap(this_network.GetInputsInfo());
             outputs = cv::gimpl::ie::wrap::toOutputsDataMap(this_network.GetOutputsInfo());
+            if (!params.reshape_table.empty() || !params.layer_names_to_reshape.empty()) {
+                GAPI_LOG_WARNING(NULL, "Reshape isn't supported for imported network");
+            }
         } else {
             cv::util::throw_error(std::logic_error("Unsupported ParamDesc::Kind"));
         }
@@ -249,6 +253,11 @@ struct IEUnit {
```

Review comment:
BTW It can be checked in `ParamDesc` because it contains `kind == Kind::Import`
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.
**Review Line:** 229

**Code Changes:**
```diff
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
             inputs  = cv::gimpl::ie::wrap::toInputsDataMap(this_network.GetInputsInfo());
             outputs = cv::gimpl::ie::wrap::toOutputsDataMap(this_network.GetOutputsInfo());
+            if (!params.reshape_table.empty() || !params.layer_names_to_reshape.empty()) {
+                GAPI_LOG_WARNING(NULL, "Reshape isn't supported for imported network");
+            }
         } else {
             cv::util::throw_error(std::logic_error("Unsupported ParamDesc::Kind"));
         }
@@ -249,6 +253,11 @@ struct IEUnit {
```

Review comment:
But may be this place is better :)
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
Why this check is necessary ?
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
Moreover where is this check for `reshape_in_names` ?
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
Discussed locally
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
`getIdxByName` is removed.
**File:** modules/gapi/include/opencv2/gapi/infer/ie.hpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -8,6 +8,7 @@
 #define OPENCV_GAPI_INFER_IE_HPP
 
 #include <unordered_map>
+#include <unordered_set>
 #include <string>
 #include <array>
 #include <tuple> // tuple, tuple_size
@@ -68,6 +69,9 @@ namespace detail {
         bool is_generic;
```

Review comment:
Changed to `shapes_for_layers_reshape` and `layers_names_for_reshape`.
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
New behavior: You can call reshape by shapes parameter for some layers and call reshape by image size for another layers. If both calls contain same layers names, then reshaping by shapes is preferred.
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
Added comments about steps.
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
It was a duplicate code. Already fixed.
**File:** modules/gapi/include/opencv2/gapi/infer/ie.hpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.
**Review Line:** 187

**Code Changes:**
```diff
+    }
+
+    Params<Net>& cfgInputReshape(const std::unordered_set<std::string>& layer_names) {
+        desc.layer_names_to_reshape = layer_names;
+        return *this;
+    }
+
     // BEGIN(G-API's network parametrization API)
     GBackend      backend()    const { return cv::gapi::ie::backend();  }
     std::string   tag()        const { return Net::tag(); }
@@ -165,13 +203,13 @@ class Params<cv::gapi::Generic> {
```

Review comment:
Added overloads.
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
Added FIXME.
**File:** modules/gapi/include/opencv2/gapi/infer/ie.hpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -8,6 +8,7 @@
 #define OPENCV_GAPI_INFER_IE_HPP
 
 #include <unordered_map>
+#include <unordered_set>
 #include <string>
 #include <array>
 #include <tuple> // tuple, tuple_size
@@ -68,6 +69,9 @@ namespace detail {
         bool is_generic;
```

Review comment:
just `std:vector<std::string>&&` without `const`
**File:** modules/gapi/include/opencv2/gapi/infer/ie.hpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -8,6 +8,7 @@
 #define OPENCV_GAPI_INFER_IE_HPP
 
 #include <unordered_map>
+#include <unordered_set>
 #include <string>
 #include <array>
 #include <tuple> // tuple, tuple_size
@@ -68,6 +69,9 @@ namespace detail {
         bool is_generic;
```

Review comment:
it didn't get any clearer
**File:** modules/gapi/include/opencv2/gapi/infer/ie.hpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -8,6 +8,7 @@
 #define OPENCV_GAPI_INFER_IE_HPP
 
 #include <unordered_map>
+#include <unordered_set>
 #include <string>
 #include <array>
 #include <tuple> // tuple, tuple_size
@@ -68,6 +69,9 @@ namespace detail {
         bool is_generic;
```

Review comment:
remove `const`
**File:** modules/gapi/include/opencv2/gapi/infer/ie.hpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -8,6 +8,7 @@
 #define OPENCV_GAPI_INFER_IE_HPP
 
 #include <unordered_map>
+#include <unordered_set>
 #include <string>
 #include <array>
 #include <tuple> // tuple, tuple_size
@@ -68,6 +69,9 @@ namespace detail {
         bool is_generic;
```

Review comment:
So, only one letter for variable name, not a good idea :(
**File:** modules/gapi/include/opencv2/gapi/infer/ie.hpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -8,6 +8,7 @@
 #define OPENCV_GAPI_INFER_IE_HPP
 
 #include <unordered_map>
+#include <unordered_set>
 #include <string>
 #include <array>
 #include <tuple> // tuple, tuple_size
@@ -68,6 +69,9 @@ namespace detail {
         bool is_generic;
```

Review comment:
use emplace instead
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
Quote is necessary ?
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
Sorry for picking on little things, but it isn't a `Checking`, you do checking below.
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
`std::make_pair` really necessary ?
**File:** modules/gapi/include/opencv2/gapi/infer/ie.hpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -8,6 +8,7 @@
 #define OPENCV_GAPI_INFER_IE_HPP
 
 #include <unordered_map>
+#include <unordered_set>
 #include <string>
 #include <array>
 #include <tuple> // tuple, tuple_size
@@ -68,6 +69,9 @@ namespace detail {
         bool is_generic;
```

Review comment:
Changed. +-
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
It isn't necessary, is it ? You anyway do assignment to `input_reshape_table`
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
No, it's a worst approach to find something in `std::map`
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
const auto&
**File:** modules/gapi/src/backends/ie/giebackend.cpp
**Change Type:** modified
**Context:** PR #18240: [G-API]: Adding reshape for CNN input.

**Code Changes:**
```diff
@@ -45,6 +45,7 @@
 #include "backends/ie/giebackend/giewrapper.hpp"
 
 #include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
+#include "logger.hpp"
 
 #if INF_ENGINE_RELEASE < 2021010000
 #include "ie_compound_blob.h"
@@ -224,6 +225,9 @@ struct IEUnit {
             // but ExecutableNetwork returns ConstInputsDataMap/ConstOutputsDataMap
```

Review comment:
Input dims will change.
**File:** modules/calib3d/src/polynom_solver.cpp
**Change Type:** modified
**Context:** PR #19583: Update polynom_solver.cpp

**Code Changes:**
```diff
@@ -65,7 +65,8 @@ int solve_deg3(double a, double b, double c, double d,
       return 3;
     }
     else {
-      x0 = pow(2 * R, 1 / 3.0) - b_a_3;
+      double cube_root = cv::cubeRoot(2 * R);
+      x0 = cube_root - b_a_3;
       return 1;
     }
   }
```

Review comment:
Please keep existed indentation coding style here (2 spaces in this file)
**File:** modules/calib3d/include/opencv2/calib3d.hpp
**Change Type:** modified
**Context:** PR #19539: Added CALIB_FIX_FOCAL_LENGTH to fisheye calibration
**Review Line:** 3777

**Code Changes:**
```diff
         CALIB_FIX_K4                = 1 << 7,
         CALIB_FIX_INTRINSIC         = 1 << 8,
         CALIB_FIX_PRINCIPAL_POINT   = 1 << 9,
-        CALIB_ZERO_DISPARITY        = 1 << 10
+        CALIB_ZERO_DISPARITY        = 1 << 10,
+        CALIB_FIX_FOCAL_LENGTH      = 1 << 11
     };
 
     /** @brief Projects points using fisheye model
@@ -3927,6 +3928,8 @@ namespace fisheye
     are set to zeros and stay zero.
```

Review comment:
Please add/extend bindings tests for constants. There is some mess with constants with the same name and different values.
**File:** modules/imgproc/src/ccl_bolelli_forest.inc.hpp
**Change Type:** added
**Context:** PR #19631: Sota ccl

**Code Changes:**
```diff
@@ -0,0 +1,1746 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+//
+// 2021 Federico Bolelli <federico.bolelli@unimore.it>
+// 2021 Stefano Allegretti <stefano.allegretti@unimore.it>
+// 2021 Costantino Grana <costantino.grana@unimore.it>
+//
+// This file has been automatically generated using GRAPHGEN (https://github.com/prittt/GRAPHGEN)
```

Review comment:
Lets update in new files only for now.
**File:** modules/java/test/pure_test/src/org/opencv/test/OpenCVTestCase.java
**Change Type:** modified
**Context:** PR #19503: Fix bug in put/get of non-continuous Mat

**Code Changes:**
```diff
@@ -305,19 +305,22 @@ public static <E extends Number> void assertListEquals(List<E> list1, List<E> li
     }
 
     public static <E extends Number> void assertArrayEquals(E[] ar1, E[] ar2, double epsilon) {
-        if (ar1.length != ar2.length) {
-            fail("Arrays have different sizes.");
-        }
+        assertEquals(ar1.length, ar2.length);
 
         for (int i = 0; i < ar1.length; i++)
```

Review comment:
`assertEqual`?
**File:** modules/core/misc/java/test/MatTest.java
**Change Type:** modified
**Context:** PR #19503: Fix bug in put/get of non-continuous Mat
**Review Line:** 471

**Code Changes:**
```diff
+        Mat matContinuous = matNonContinuous.clone();
+        short[] outNonContinuous = new short[(int)matNonContinuous.total()];
+        matNonContinuous.get(new int[] { 0, 0, 0 }, outNonContinuous);
+        short[] outContinuous = new short[(int)matNonContinuous.total()];
+        matContinuous.get(new int[] { 0, 0, 0 }, outContinuous);
+        assertArrayEquals(outNonContinuous, outContinuous);
+        Mat subMat2 = m2.submat(new Range[]{new Range(1,4), new Range(1,5), new Range(0,8)});
+        Mat subMatClone2 = subMat2.clone();
+        short[] outNonContinuous2 = new short[(int)subMat2.total()];
+        subMat2.get(new int[] { 0, 1, 1 }, outNonContinuous2);
+        short[] outContinuous2 = new short[(int)subMat2.total()];
```

Review comment:
`assertMatEqual` does not check continuity flag. You can try it instead of custom method.
**File:** modules/java/generator/src/cpp/Mat.cpp
**Change Type:** modified
**Context:** PR #19503: Fix bug in put/get of non-continuous Mat

**Code Changes:**
```diff
@@ -2129,80 +2129,83 @@ namespace {
 #undef JOCvT
 }
 
-template<typename T> static int mat_put(cv::Mat* m, int row, int col, int count, int offset, char* buff)
-{
-    if(! m) return 0;
-    if(! buff) return 0;
-
-    count *= sizeof(T);
```

Review comment:
Increasing by one multiple times is really slow (for HD images `inc` value is up to 1280). We need "fast path" to handle "always contiguous" last dim (cols). ``` { int cols_dim = mat->dims - 1; size_t cols = mat->size[cols_dim]; CV_CheckLE(cols, (size_t)INT_MAX, ""); // 'int' only, size_t type is not supported for indexes size_t new_cols_idx = (size_t)indices[cols_dim] + inc; // only "cols" idx is allowed to be increased till the end // do not allow to jump forward because we should support non-contiguous layouts too (submats) CV_CheckLE(new_cols_idx, cols, ""); if (new_cols_idx == cols) { indices[cols_dim] = 0; for (int dim = cols_dim - 1; dim >= 0; --dim) { int new_idx = indices[dim] + 1; if (new_idx != mat->size[dim]) { indices[dim] = new_idx; return false; } else { indices[dim] = 0; continue; } } return true; } else { indices[cols_dim] = (int)new_cols_idx; return false; } } ```
**File:** modules/core/misc/java/test/MatTest.java
**Change Type:** modified
**Context:** PR #19503: Fix bug in put/get of non-continuous Mat

**Code Changes:**
```diff
@@ -455,6 +455,27 @@ public void testGetIntIntShortArray() {
         bytesNum = sm.get(1, 1, buff11);
         assertEquals(4, bytesNum);
         assertTrue(Arrays.equals(new short[] {340, 341, 0, 0}, buff11));
+
+        Mat m2 = new Mat(new int[]{ 5, 6, 8 }, CvType.CV_16S);
+        short[] data = new short[(int)m2.total()];
+        for (int i = 0; i < data.length; i++ ) {
+            data[i] = (short)i;
+        }
```

Review comment:
> 5, 5, 5 different numbers are preferable (to ensure that we don't mess with "size[]" array order in implementation): ``` 5, 6, 8 ```
**File:** modules/java/generator/src/cpp/Mat.cpp
**Change Type:** modified
**Context:** PR #19503: Fix bug in put/get of non-continuous Mat

**Code Changes:**
```diff
@@ -2129,80 +2129,83 @@ namespace {
 #undef JOCvT
 }
 
-template<typename T> static int mat_put(cv::Mat* m, int row, int col, int count, int offset, char* buff)
-{
-    if(! m) return 0;
-    if(! buff) return 0;
-
-    count *= sizeof(T);
```

Review comment:
Actually updating the indices doesn't require any iteration - we can just calculate where the new indices will end up. But I get your point - we can optimize the copying of data if the trailing dimensions are contiguous. Will push a new optimized implementation.
**File:** modules/core/misc/java/test/MatTest.java
**Change Type:** modified
**Context:** PR #19503: Fix bug in put/get of non-continuous Mat
**Review Line:** 471

**Code Changes:**
```diff
+        Mat matContinuous = matNonContinuous.clone();
+        short[] outNonContinuous = new short[(int)matNonContinuous.total()];
+        matNonContinuous.get(new int[] { 0, 0, 0 }, outNonContinuous);
+        short[] outContinuous = new short[(int)matNonContinuous.total()];
+        matContinuous.get(new int[] { 0, 0, 0 }, outContinuous);
+        assertArrayEquals(outNonContinuous, outContinuous);
+        Mat subMat2 = m2.submat(new Range[]{new Range(1,4), new Range(1,5), new Range(0,8)});
+        Mat subMatClone2 = subMat2.clone();
+        short[] outNonContinuous2 = new short[(int)subMat2.total()];
+        subMat2.get(new int[] { 0, 1, 1 }, outNonContinuous2);
+        short[] outContinuous2 = new short[(int)subMat2.total()];
```

Review comment:
You are right. Sorry, missed `get` call in the code.
**File:** modules/dnn/src/layers/elementwise_layers.cpp
**Change Type:** modified
**Context:** PR #19620: Fixed several issues found by static analysis

**Code Changes:**
```diff
@@ -1408,29 +1408,24 @@ struct ExpFunctor : public BaseFunctor
 
     ExpFunctor(float base_ = -1.f, float scale_ = 1.f, float shift_ = 0.f)
         : base(base_), scale(scale_), shift(shift_)
-    {
-        CV_Check(base, base == -1.f || base > 0.f, "Unsupported 'base' value");
-    }
-
-    bool supportBackend(int backendId, int targetId)
-    {
```

Review comment:
It make sense to move finalize "body" here instead (and keep finalize empty).