nareshmlx/opencv-pr huggingface dataset:
**File:** modules/dnn/src/vkcom/src/vkcom.cpp
**Change Type:** added
**Context:** PR #12703: dnn: Add a Vulkan based backend - This commit adds a new backend "DNN_BACKEND_VKCOM" and a new target "DNN_TARGET_VULKAN". VKCOM means vulk...
**Review Line:** 95

**Code Changes:**
```diff
+
+    VKCOM_CHECK_BOOL_RET_VAL(init(), false);
+    Context* ctx = getContext();
+    if (ctx)
+    {
+        ctx->ref++;
+        return true;
+    }
+
+    // create device, queue, command pool
+    VkDeviceQueueCreateInfo queueCreateInfo = {};
```

Review comment:
`ctx` is "thread local"? If it is not, then the reference counted should be synchronized between threads properly (via `CV_XADD()` macro or use `std::atomic<int>` (OpenCV 4.0 requires C++11) ).
**File:** modules/gapi/doc/00-root.markdown
**Change Type:** added
**Context:** PR #12857: G-API Documentation: first submission - This PR introduces a number of new OpenCV documentation chapters for Graph API module. In particula...

**Code Changes:**
```diff
@@ -0,0 +1,109 @@
+# Graph API {#gapi}
+
+# Introduction {#gapi_root_intro}
+
+OpenCV Graph API (or G-API) is a new OpenCV module targeted to make
+regular image processing fast and portable. These two goals are
+achieved by introducing a new graph-based model of execution.
+
+G-API is a special module in OpenCV -- in contrast with the majority
```

Review comment:
Please use .jpg format (with ~90% quality) for real-like images. PNG is not very good for this purpose. Other images (schemes) are fine to store in png format.
**File:** modules/gapi/doc/00-root.markdown
**Change Type:** added
**Context:** PR #12857: G-API Documentation: first submission - This PR introduces a number of new OpenCV documentation chapters for Graph API module. In particula...

**Code Changes:**
```diff
@@ -0,0 +1,109 @@
+# Graph API {#gapi}
+
+# Introduction {#gapi_root_intro}
+
+OpenCV Graph API (or G-API) is a new OpenCV module targeted to make
+regular image processing fast and portable. These two goals are
+achieved by introducing a new graph-based model of execution.
+
+G-API is a special module in OpenCV -- in contrast with the majority
```

Review comment:
This is not a tutorial, this is an [almost useless] API sample -- just for an introduction. I will add a more detailed tutorial into a proper location as it gets ready.
**File:** modules/gapi/doc/00-root.markdown
**Change Type:** added
**Context:** PR #12857: G-API Documentation: first submission - This PR introduces a number of new OpenCV documentation chapters for Graph API module. In particula...

**Code Changes:**
```diff
@@ -0,0 +1,109 @@
+# Graph API {#gapi}
+
+# Introduction {#gapi_root_intro}
+
+OpenCV Graph API (or G-API) is a new OpenCV module targeted to make
+regular image processing fast and portable. These two goals are
+achieved by introducing a new graph-based model of execution.
+
+G-API is a special module in OpenCV -- in contrast with the majority
```

Review comment:
`opencv.hpp` is deprecated header. We don't use it in OpenCV samples. ``` #include <opencv2/core.hpp> #include <opencv2/videoio.hpp> #include <opencv2/highgui.hpp> ```
**File:** modules/gapi/doc/00-root.markdown
**Change Type:** added
**Context:** PR #12857: G-API Documentation: first submission - This PR introduces a number of new OpenCV documentation chapters for Graph API module. In particula...

**Code Changes:**
```diff
@@ -0,0 +1,109 @@
+# Graph API {#gapi}
+
+# Introduction {#gapi_root_intro}
+
+OpenCV Graph API (or G-API) is a new OpenCV module targeted to make
+regular image processing fast and portable. These two goals are
+achieved by introducing a new graph-based model of execution.
+
+G-API is a special module in OpenCV -- in contrast with the majority
```

Review comment:
canny -> Canny to fix compilation
**File:** modules/gapi/doc/00-root.markdown
**Change Type:** added
**Context:** PR #12857: G-API Documentation: first submission - This PR introduces a number of new OpenCV documentation chapters for Graph API module. In particula...

**Code Changes:**
```diff
@@ -0,0 +1,109 @@
+# Graph API {#gapi}
+
+# Introduction {#gapi_root_intro}
+
+OpenCV Graph API (or G-API) is a new OpenCV module targeted to make
+regular image processing fast and portable. These two goals are
+achieved by introducing a new graph-based model of execution.
+
+G-API is a special module in OpenCV -- in contrast with the majority
```

Review comment:
OpenCV Doxyfile contains `modules/gapi/doc` in `EXAMPLE_PATH` list, so using of `code/api_example.cpp` is enough to point on the file. This is another reason to add "gapi_" prefix to file names (to keep them unique).
**File:** modules/core/include/opencv2/core/utility.hpp
**Change Type:** modified
**Context:** PR #12658: hide use of std::mutex from /clr compilation under Visual Studio - C++11 `<mutex>` is not available when compiling with /clr under Visual S...

**Code Changes:**
```diff
@@ -58,7 +58,9 @@
 
 #include <functional>
 
+#if !defined(_M_CEE)
 #include <mutex>  // std::mutex, std::lock_guard
+#endif
 
 namespace cv
 {
```

Review comment:
Can we just put custom definitions of Mutex and AutoLock here instead of introducing proxy classes CEEMutex and CEELockGuard?
**File:** modules/core/include/opencv2/core/utility.hpp
**Change Type:** modified
**Context:** PR #12658: hide use of std::mutex from /clr compilation under Visual Studio - C++11 `<mutex>` is not available when compiling with /clr under Visual S...

**Code Changes:**
```diff
@@ -58,7 +58,9 @@
 
 #include <functional>
 
+#if !defined(_M_CEE)
 #include <mutex>  // std::mutex, std::lock_guard
+#endif
 
 namespace cv
 {
```

Review comment:
I don't think so. CEEMutex and CEELockGuard must be compiled anyway, so that the opencv dll built without /clr will still work when linked to a /clr program including opencv headers
**File:** modules/core/include/opencv2/core/utility.hpp
**Change Type:** modified
**Context:** PR #12658: hide use of std::mutex from /clr compilation under Visual Studio - C++11 `<mutex>` is not available when compiling with /clr under Visual S...

**Code Changes:**
```diff
@@ -58,7 +58,9 @@
 
 #include <functional>
 
+#if !defined(_M_CEE)
 #include <mutex>  // std::mutex, std::lock_guard
+#endif
 
 namespace cv
 {
```

Review comment:
What API requires Mutex/AutoLock emulation?
**File:** modules/core/include/opencv2/core/utility.hpp
**Change Type:** modified
**Context:** PR #12658: hide use of std::mutex from /clr compilation under Visual Studio - C++11 `<mutex>` is not available when compiling with /clr under Visual S...

**Code Changes:**
```diff
@@ -58,7 +58,9 @@
 
 #include <functional>
 
+#if !defined(_M_CEE)
 #include <mutex>  // std::mutex, std::lock_guard
+#endif
 
 namespace cv
 {
```

Review comment:
KMeansDistanceComputer from flann
**File:** modules/core/include/opencv2/core/utility.hpp
**Change Type:** modified
**Context:** PR #12658: hide use of std::mutex from /clr compilation under Visual Studio - C++11 `<mutex>` is not available when compiling with /clr under Visual S...

**Code Changes:**
```diff
@@ -58,7 +58,9 @@
 
 #include <functional>
 
+#if !defined(_M_CEE)
 #include <mutex>  // std::mutex, std::lock_guard
+#endif
 
 namespace cv
 {
```

Review comment:
Looks like, mutex is misused there. Removed: #12660
**File:** modules/core/include/opencv2/core/utility.hpp
**Change Type:** modified
**Context:** PR #12658: hide use of std::mutex from /clr compilation under Visual Studio - C++11 `<mutex>` is not available when compiling with /clr under Visual S...

**Code Changes:**
```diff
@@ -58,7 +58,9 @@
 
 #include <functional>
 
+#if !defined(_M_CEE)
 #include <mutex>  // std::mutex, std::lock_guard
+#endif
 
 namespace cv
 {
```

Review comment:
Indeed, when #12660 is commited, cv::Mutex can just be made unavailable from /clr builds (and CEEMutex/CEELockGuard can be removed) The only drawback is that under a /clr build, the developer won't be able to just copy/paste valid code using cv::Mutex or cv::AuLock, and will have to rely on a custom implementation of his own
**File:** modules/core/include/opencv2/core/utility.hpp
**Change Type:** modified
**Context:** PR #12658: hide use of std::mutex from /clr compilation under Visual Studio - C++11 `<mutex>` is not available when compiling with /clr under Visual S...

**Code Changes:**
```diff
@@ -58,7 +58,9 @@
 
 #include <functional>
 
+#if !defined(_M_CEE)
 #include <mutex>  // std::mutex, std::lock_guard
+#endif
 
 namespace cv
 {
```

Review comment:
I believe CLR assumes using of own mechanics for synchronization instead of raw Mutex.
**File:** modules/gapi/CMakeLists.txt
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 24

**Code Changes:**
```diff
+    "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/own/*.hpp"
+    )
+
+set(gapi_srcs
+    # Front-end part
+    src/api/gapi_priv.cpp
+    src/api/gmat.cpp
+    src/api/garray.cpp
+    src/api/gscalar.cpp
+    src/api/gkernel.cpp
+    src/api/gbackend.cpp
```

Review comment:
Please prepend "${CMAKE_CURRENT_LIST_DIR}/" to each of the sources to fix world build and iOS package build.
**File:** modules/gapi/CMakeLists.txt
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 3

**Code Changes:**
```diff
@@ -0,0 +1,94 @@
+# FIXME: Remove CXX11 check after complete switch to OpenCV 4 branch
+# (CI, bundle, workloads, etc)
+if (NOT HAVE_CXX11 OR NOT TARGET ade)
+  # can't build G-API because of the above reasons
+  ocv_module_disable(gapi)
+  return()
+endif()
+
```

Review comment:
Maybe we should disable building this module with older GCC versions due to missing `std::aligned_union`. Something like this: ```.cmake if ((CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) OR ...) ```
**File:** modules/gapi/cmake/DownloadADE.cmake
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 31

**Code Changes:**
```diff
+file(GLOB_RECURSE ADE_sources "${ADE_root}/source/*.cpp")
+file(GLOB_RECURSE ADE_include "${ADE_root}/include/ade/*.hpp")
+add_library(ade STATIC ${ADE_include} ${ADE_sources})
+target_include_directories(ade PUBLIC $<BUILD_INTERFACE:${ADE_root}/include>)
+set_target_properties(ade PROPERTIES POSITION_INDEPENDENT_CODE True)
+
+if(NOT BUILD_SHARED_LIBS)
+  ocv_install_target(ade EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
+endif()
+
+ocv_install_3rdparty_licenses(ade "${ade_src_dir}/${ade_subdir}/LICENSE")
```

Review comment:
We can disable warnings for now by adding: ```.cmake ocv_warnings_disable(CMAKE_CXX_FLAGS -Wsuggest-override -Wshadow) ```
**File:** modules/gapi/CMakeLists.txt
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 24

**Code Changes:**
```diff
+    "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/own/*.hpp"
+    )
+
+set(gapi_srcs
+    # Front-end part
+    src/api/gapi_priv.cpp
+    src/api/gmat.cpp
+    src/api/garray.cpp
+    src/api/gscalar.cpp
+    src/api/gkernel.cpp
+    src/api/gbackend.cpp
```

Review comment:
Use `ocv_list_add_prefix(gapi_srcs "${CMAKE_CURRENT_LIST_DIR}/")` for that.
**File:** modules/gapi/CMakeLists.txt
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 3

**Code Changes:**
```diff
@@ -0,0 +1,94 @@
+# FIXME: Remove CXX11 check after complete switch to OpenCV 4 branch
+# (CI, bundle, workloads, etc)
+if (NOT HAVE_CXX11 OR NOT TARGET ade)
+  # can't build G-API because of the above reasons
+  ocv_module_disable(gapi)
+  return()
+endif()
+
```

Review comment:
I think we better rewrite that code and drop aligned_union
**File:** modules/gapi/CMakeLists.txt
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 3

**Code Changes:**
```diff
@@ -0,0 +1,94 @@
+# FIXME: Remove CXX11 check after complete switch to OpenCV 4 branch
+# (CI, bundle, workloads, etc)
+if (NOT HAVE_CXX11 OR NOT TARGET ade)
+  # can't build G-API because of the above reasons
+  ocv_module_disable(gapi)
+  return()
+endif()
+
```

Review comment:
Should be fixed now (at least build passes locally with gcc4.8)
**File:** modules/gapi/cmake/DownloadADE.cmake
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 31

**Code Changes:**
```diff
+file(GLOB_RECURSE ADE_sources "${ADE_root}/source/*.cpp")
+file(GLOB_RECURSE ADE_include "${ADE_root}/include/ade/*.hpp")
+add_library(ade STATIC ${ADE_include} ${ADE_sources})
+target_include_directories(ade PUBLIC $<BUILD_INTERFACE:${ADE_root}/include>)
+set_target_properties(ade PROPERTIES POSITION_INDEPENDENT_CODE True)
+
+if(NOT BUILD_SHARED_LIBS)
+  ocv_install_target(ade EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
+endif()
+
+ocv_install_3rdparty_licenses(ade "${ade_src_dir}/${ade_subdir}/LICENSE")
```

Review comment:
Addressed warnings in the code
**File:** modules/gapi/include/opencv2/gapi/gkernel.hpp
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 385

**Code Changes:**
```diff
+        // Just note that `f(),a` always equals to `a` (with f() called!)
+        // and parentheses are used to hide function call in the expanded sequence.
+        // Leading 0 helps to handle case when KK is an empty list (kernels<>()).
+
+        int unused[] = { 0, (pkg.include<KK>(), 0)... };
+        cv::util::suppress_unused_warning(unused);
+        return pkg;
+    };
+
+    // Return a new package based on `lhs` and `rhs`,
+    // with unity policy defined by `policy`.
```

Review comment:
There is `CV_UNUSED` macro in the _core_ module.
**File:** modules/gapi/include/opencv2/gapi/gkernel.hpp
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 385

**Code Changes:**
```diff
+        // Just note that `f(),a` always equals to `a` (with f() called!)
+        // and parentheses are used to hide function call in the expanded sequence.
+        // Leading 0 helps to handle case when KK is an empty list (kernels<>()).
+
+        int unused[] = { 0, (pkg.include<KK>(), 0)... };
+        cv::util::suppress_unused_warning(unused);
+        return pkg;
+    };
+
+    // Return a new package based on `lhs` and `rhs`,
+    // with unity policy defined by `policy`.
```

Review comment:
As G-API is being decoupled from OpenCV in parallel, we'll need to have our own
**File:** modules/gapi/include/opencv2/gapi/core.hpp
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 390

**Code Changes:**
```diff
+            else
+            {
+                GAPI_Assert(fx != 0. && fy != 0.);
+                return in.withSize
+                    (Size(static_cast<int>(std::round(in.size.width  * fx)),
+                          static_cast<int>(std::round(in.size.height * fy))));
+            }
+        }
+    };
+
+    G_TYPED_KERNEL(GMerge3, <GMat(GMat,GMat,GMat)>, "org.opencv.core.transform.merge3") {
```

Review comment:
std::round? Perhaps this should not have huge impact if `fx`/`fy` is not passed into "implementation" functions after that (only `dstSize` is used).
**File:** modules/gapi/test/internal/gapi_transactions_test.cpp
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 8

**Code Changes:**
```diff
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2018 Intel Corporation
+
+
+#include "test_precomp.hpp"
+#include <ade/graph.hpp>
+#include "compiler/transactions.hpp"
+
+namespace opencv_test
+{
```

Review comment:
"precomp.hpp" should be the first unconditional include.
**File:** modules/gapi/test/internal/gapi_int_island_fusion_tests.cpp
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 8

**Code Changes:**
```diff
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2018 Intel Corporation
+
+
+#include "test_precomp.hpp"
+#include "compiler/transactions.hpp"
+
+#include "gapi_mock_kernels.hpp"
+
+#include "compiler/gmodel.hpp"
```

Review comment:
"precomp.hpp" should be the first unconditional include.
**File:** modules/gapi/test/internal/gapi_int_gmodel_builder_test.cpp
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 8

**Code Changes:**
```diff
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2018 Intel Corporation
+
+
+#include "test_precomp.hpp"
+
+#include <ade/util/zip_range.hpp>   // util::indexed
+
+#include "opencv2/gapi/gkernel.hpp"
+#include "compiler/gmodelbuilder.hpp"
```

Review comment:
"precomp.hpp" should be the first unconditional include.
**File:** modules/gapi/test/gapi_util_tests.cpp
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 8

**Code Changes:**
```diff
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2018 Intel Corporation
+
+
+#include "test_precomp.hpp"
+
+#include <type_traits>
+
+#include "opencv2/gapi/util/util.hpp"
+
```

Review comment:
"precomp.hpp" should be the first unconditional include.
**File:** modules/gapi/test/gapi_mock_kernels.hpp
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...

**Code Changes:**
```diff
@@ -0,0 +1,123 @@
+// 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.
+//
+// Copyright (C) 2018 Intel Corporation
+
+
+#include "opencv2/gapi/cpu/gcpukernel.hpp"
+
```

Review comment:
Please avoid using of "precomp.hpp" in header files (it should/must be used in .cpp files only). Introduce some "test_common.hpp" if you really need to include set of common headers. Similar files: - modules/gapi/test/common/gapi_core_tests.hpp - modules/gapi/test/common/gapi_imgproc_tests.hpp - modules/gapi/test/common/gapi_operators_tests.hpp - modules/gapi/test/gapi_fluid_test_kernels.hpp - modules/gapi/src/backends/common/gbackend.hpp - modules/gapi/perf/common/gapi_imgproc_perf_tests.hpp
**File:** modules/gapi/include/opencv2/gapi/core.hpp
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 390

**Code Changes:**
```diff
+            else
+            {
+                GAPI_Assert(fx != 0. && fy != 0.);
+                return in.withSize
+                    (Size(static_cast<int>(std::round(in.size.width  * fx)),
+                          static_cast<int>(std::round(in.size.height * fy))));
+            }
+        }
+    };
+
+    G_TYPED_KERNEL(GMerge3, <GMat(GMat,GMat,GMat)>, "org.opencv.core.transform.merge3") {
```

Review comment:
Not sure what you mean
**File:** modules/gapi/include/opencv2/gapi/core.hpp
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 390

**Code Changes:**
```diff
+            else
+            {
+                GAPI_Assert(fx != 0. && fy != 0.);
+                return in.withSize
+                    (Size(static_cast<int>(std::round(in.size.width  * fx)),
+                          static_cast<int>(std::round(in.size.height * fy))));
+            }
+        }
+    };
+
+    G_TYPED_KERNEL(GMerge3, <GMat(GMat,GMat,GMat)>, "org.opencv.core.transform.merge3") {
```

Review comment:
OpenCV uses own `cvRound()` (nearest-to-even) in `cv::resize()`.
**File:** modules/gapi/include/opencv2/gapi/core.hpp
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 390

**Code Changes:**
```diff
+            else
+            {
+                GAPI_Assert(fx != 0. && fy != 0.);
+                return in.withSize
+                    (Size(static_cast<int>(std::round(in.size.width  * fx)),
+                          static_cast<int>(std::round(in.size.height * fy))));
+            }
+        }
+    };
+
+    G_TYPED_KERNEL(GMerge3, <GMat(GMat,GMat,GMat)>, "org.opencv.core.transform.merge3") {
```

Review comment:
ah ok. We do pass tests against cv::resize() already, so let's put this stuff into the backlog so address later (within the release timeframe).
**File:** modules/gapi/test/internal/gapi_transactions_test.cpp
**Change Type:** added
**Context:** PR #12608: G-API Initial code upload - This is the initial source code upload for new OpenCV 4 module "Graph API": > OpenCV Graph API (or G-API) is a ...
**Review Line:** 8

**Code Changes:**
```diff
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2018 Intel Corporation
+
+
+#include "test_precomp.hpp"
+#include <ade/graph.hpp>
+#include "compiler/transactions.hpp"
+
+namespace opencv_test
+{
```

Review comment:
This and all below issues are now resolved
**File:** modules/core/include/opencv2/core/hal/intrin_avx.hpp
**Change Type:** modified
**Context:** PR #12516: core:unv Change behaviour of 16-bit multiply operator - This patch paves the way for #12064 Merge with opencv_contrib: opencv/opencv_contri...
**Review Line:** 672

**Code Changes:**
```diff
+{
+    v_int16x16 c, d;
+    v_mul_expand(a, b, c, d);
+    return v_pack(c, d);
+}
+inline v_uint16x16 operator * (const v_uint16x16& a, const v_uint16x16& b)
+{
+    __m256i pl = _mm256_mullo_epi16(a.val, b.val);
+    __m256i ph = _mm256_mulhi_epu16(a.val, b.val);
+    __m256i p0 = _mm256_unpacklo_epi16(pl, ph);
+    __m256i p1 = _mm256_unpackhi_epi16(pl, ph);
```

Review comment:
in general, all the saturation `*` operations can be implemented as v_mul_expand() + v_pack().