instruction stringclasses 9
values | input stringlengths 279 5.47k | output stringlengths 6 9.58k |
|---|---|---|
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core/hal/intrin.hpp
**Change Type:** modified
**Context:** PR #24941: Add support for v_exp (exponential)
**Code Changes:**
```diff
@@ -1239,6 +1239,7 @@ namespace CV__SIMD_NAMESPACE {
#define CV_SIMD 0
#endif
+#include "intrin_math.hpp"
#include "simd_utils.impl.hpp"
#if... | Also I propose to add reference to some paper, description, or implementation details, if you have it. |
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core/hal/intrin.hpp
**Change Type:** modified
**Context:** PR #24941: Add support for v_exp (exponential)
**Code Changes:**
```diff
@@ -1239,6 +1239,7 @@ namespace CV__SIMD_NAMESPACE {
#define CV_SIMD 0
#endif
+#include "intrin_math.hpp"
#include "simd_utils.impl.hpp"
#if... | > Also I propose to add reference to some paper, description, or implementation details, if you have it. I cannot find the original paper; I only found the code and some comments. I already added these comments and references. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core/hal/intrin.hpp
**Change Type:** modified
**Context:** PR #24941: Add support for v_exp (exponential)
**Code Changes:**
```diff
@@ -1239,6 +1239,7 @@ namespace CV__SIMD_NAMESPACE {
#define CV_SIMD 0
#endif
+#include "intrin_math.hpp"
#include "simd_utils.impl.hpp"
#if... | The fallback with just loop and standatrd exp is still needed. We have platforms, where fma/sse/avx/neon are not implemented. Looped exp should be better there. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core/hal/intrin_cpp.hpp
**Change Type:** modified
**Context:** PR #24941: Add support for v_exp (exponential)
**Review Line:** 724
**Code Changes:**
```diff
@{ */
@@ -721,11 +722,33 @@ template<typename _Tp, int n> inline v_reg<_Tp2, n> func(const v_reg<_Tp, n>& a)
Only for ... | insert ``` #define OPENCV_HAL_MATH_HAVE_EXP 1 #define OPENCV_HAL_MATH_HAVE_LOG 1 #define OPENCV_HAL_MATH_HAVE_SIN 1 #define OPENCV_HAL_MATH_HAVE_COS 1 ``` |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core/hal/intrin_math.hpp
**Change Type:** added
**Context:** PR #24941: Add support for v_exp (exponential)
**Review Line:** 94
**Code Changes:**
```diff
+ return v_select(mask_not_nan, _vexp_y, v_reinterpret_as_f16(vx_setall_s16(0x7e00)));
+ }
+#endif
+
+ inline v_f... | In general OpenCV SIMD provides for each compilation unit (.cpp file) all **available** of these: - SIMD128 types and `v_` functions - SIMD256 types and `v256_` functions - SIMD512 types and `v512_` functions - aliases for SIMDMAX types and necessary `vx_` functions Here we have just one definition. And plus one SIMD12... |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/test/test_intrin_utils.hpp
**Change Type:** modified
**Context:** PR #24941: Add support for v_exp (exponential)
**Review Line:** 2038
**Code Changes:**
```diff
@@ -1698,6 +1698,103 @@ template<typename R> struct TheTest
return *this;
}
+ void __test_exp(LaneType dataMax, Lane... | Why is it removed? |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/test/test_intrin_utils.hpp
**Change Type:** modified
**Context:** PR #24941: Add support for v_exp (exponential)
**Review Line:** 2038
**Code Changes:**
```diff
@@ -1698,6 +1698,103 @@ template<typename R> struct TheTest
return *this;
}
+ void __test_exp(LaneType dataMax, Lane... | I think it's by accident. I will add it back. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core/hal/intrin_math.hpp
**Change Type:** added
**Context:** PR #24941: Add support for v_exp (exponential)
**Review Line:** 94
**Code Changes:**
```diff
+ return v_select(mask_not_nan, _vexp_y, v_reinterpret_as_f16(vx_setall_s16(0x7e00)));
+ }
+#endif
+
+ inline v_f... | So should I provide `v_`, `v256_`, `v512_` and `vx_` versions implementation in `intrin_math.hpp` like `simd_utils.impl.hpp`? That's really will make many duplicated code. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core/hal/intrin_math.hpp
**Change Type:** added
**Context:** PR #24941: Add support for v_exp (exponential)
**Review Line:** 94
**Code Changes:**
```diff
+ return v_select(mask_not_nan, _vexp_y, v_reinterpret_as_f16(vx_setall_s16(0x7e00)));
+ }
+#endif
+
+ inline v_f... | It must be a better way of doing it without duplication. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Code Changes:**
```diff
@@ -1536,12 +1536,14 @@ respectively (see #getGaussianKernel for details); to fully control the result r
possible fut... | the flag to allow non-bit-exact implementations should be called universally and added universally to multiple functions. This very solution looks like quite ugly hack. Let's think of it and do properly. In IPP they used AlgorithmHint or something like that. Such enumeration as a separate proper enumeration could be ad... |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/src/smooth.dispatch.cpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Code Changes:**
```diff
@@ -468,7 +468,7 @@ static bool openvx_gaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
#endif
-#if define... | Maybe it would be better to add this condition (negated) conditions on lines 657 and 726? Currently it looks like this: ```.cpp if (depth==CV_8U && <something>) { // ... more conditions // trying OCL - ocl_sepFilter2D_BitExact // trying HAL - gaussianBlurBinomial if (allow_approximations) { // trying IPP - ipp_Gaussian... |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Review Line:** 159
**Code Changes:**
```diff
+*/
+enum AlgorithmHint {
+ ALGO_DEFAULT = 0, //!< Default algorithm behaviour defined during OpenCV... | 'Implementation' word is not good, in my opinion, too long to type. `AlgoHint` is better. ``` enum class AlgoHint { Default = 0, Fast = 1, Inherit = 2 }; ``` |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Code Changes:**
```diff
@@ -1536,12 +1536,14 @@ respectively (see #getGaussianKernel for details); to fully control the result r
possible fut... | use explicit type instead of int |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Code Changes:**
```diff
@@ -1536,12 +1536,14 @@ respectively (see #getGaussianKernel for details); to fully control the result r
possible fut... | int => ImplementationHint ? |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Code Changes:**
```diff
@@ -1536,12 +1536,14 @@ respectively (see #getGaussianKernel for details); to fully control the result r
possible fut... | How to mix Fast+Inherit then? |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Code Changes:**
```diff
@@ -1536,12 +1536,14 @@ respectively (see #getGaussianKernel for details); to fully control the result r
possible fut... | what's the meaning of Fast+Inherit? it's very confusing. In my opinion, 'inherit' itself is confusing. Instead, the hint could be explicitly passed from the parent function to child: ``` void opticalFlowABC(...., AlgoHint hint) { GaussianBlur(prev_layer, smoothed_prev_layer, ...., hint); // pass hint explicitly from th... |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/src/smooth.dispatch.cpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Code Changes:**
```diff
@@ -468,7 +468,7 @@ static bool openvx_gaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
#endif
-#if define... | Fixed HAL-IPP order. In case if "faster" branch does not work or not available we need to fallback to bit-exact implementation. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Review Line:** 159
**Code Changes:**
```diff
+*/
+enum AlgorithmHint {
+ ALGO_DEFAULT = 0, //!< Default algorithm behaviour defined during OpenCV... | Renamed the enum and removed hint for now as we do not have a case for it. |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Code Changes:**
```diff
@@ -1258,7 +1258,11 @@ if(CMAKE_GENERATOR MATCHES "Xcode|Visual Studio|Multi-Config")
else()
status(" Configuration:" ${CMAKE_BUILD_TYPE})
... | no space in CMake after `if` |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Code Changes:**
```diff
@@ -1536,12 +1536,14 @@ respectively (see #getGaussianKernel for details); to fully control the result r
possible fut... | > `= getDefaultAlgoHint()` We should avoid extra calls on the user size. This bloats user binary code. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/test/test_smooth_bitexact.cpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Review Line:** 300
**Code Changes:**
```diff
+
+ cv::Mat diff;
+ cv::absdiff(dst, gt, diff);
+ cv::Mat flatten_diff = diff.reshape(... | norm is faster than `countNonZero` approach. Use relative NORM_L1/L2 and NORM_INF instead. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Code Changes:**
```diff
@@ -150,6 +150,18 @@ It is possible to alternate error processing by using #redirectError().
*/
CV_EXPORTS CV_NORETURN vo... | > AlgorithmHint > AlgoHint We should avoid naming mess. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Code Changes:**
```diff
@@ -1536,12 +1536,14 @@ respectively (see #getGaussianKernel for details); to fully control the result r
possible fut... | Fixed by introducing ALGO_DEFAULT. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/test/test_smooth_bitexact.cpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Review Line:** 300
**Code Changes:**
```diff
+
+ cv::Mat diff;
+ cv::absdiff(dst, gt, diff);
+ cv::Mat flatten_diff = diff.reshape(... | I intentionally split the check on min-max deviation and amount of different pixels. |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Review Line:** 161
**Code Changes:**
```diff
+ ALGO_DEFAULT = 0, //!< Default algorithm behaviour defined during OpenCV build
+ ALGO_ACCURATE ... | > ImplementationHint not renamed --- > `IMPL_DEFAULT` What is that? |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Review Line:** 157
**Code Changes:**
```diff
+/*! @brief Flags that allow to midify some functions behavior. Used as set of flags.
+*/
+enum Algor... | `ALGO_HINT_` then. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/src/system.cpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Review Line:** 49
**Code Changes:**
```diff
@@ -46,6 +46,7 @@
#include <iostream>
#include <ostream>
+#include <opencv2/core.hpp>
#include <opencv2/core/... | To be removed. |
You are an expert OpenCV code reviewer specializing in performance optimization. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Review Line:** 163
**Code Changes:**
```diff
+ ALGO_APPROX = 2, //!< Allow alternative approximations to get faster implementation. Behaviour and... | Should go to `utility.hpp` somewhere near `setUseOptimized()` |
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/test/test_smooth_bitexact.cpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Review Line:** 300
**Code Changes:**
```diff
+
+ cv::Mat diff;
+ cv::absdiff(dst, gt, diff);
+ cv::Mat flatten_diff = diff.reshape(... | > `EXPECT_LE(max_val, 2); // expectes results floating +-1` comment doesn't follow to the check anyway. NORM_INF <=1 works perfect. With 1-limited NORM_INF, we could use NORM_L1 + RELATIVE to define the part of pixels of different values. |
You are an expert OpenCV code reviewer specializing in performance optimization. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core.hpp
**Change Type:** modified
**Context:** PR #25792: Added flag to GaussianBlur for faster but not bit-exact implementation
**Review Line:** 163
**Code Changes:**
```diff
+ ALGO_APPROX = 2, //!< Allow alternative approximations to get faster implementation. Behaviour and... | `setUseOptimized()` should also control behavior of that: - `setUseOptimized(false)` disables these hints and use accurate versions. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/highgui/src/window_gtk.cpp
**Change Type:** modified
**Context:** PR #25822: Support OpenGL GTK3 New API
**Code Changes:**
```diff
@@ -46,10 +46,7 @@
#include <gtk/gtk.h>
-#if (GTK_MAJOR_VERSION == 3) && defined(HAVE_OPENGL)
- #undef HAVE_OPENGL // no support with GTK3
-#endif
-#if defined(HAV... | libepoxy is not used and may be removed. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/highgui/src/window_gtk.cpp
**Change Type:** modified
**Context:** PR #25822: Support OpenGL GTK3 New API
**Code Changes:**
```diff
@@ -46,10 +46,7 @@
#include <gtk/gtk.h>
-#if (GTK_MAJOR_VERSION == 3) && defined(HAVE_OPENGL)
- #undef HAVE_OPENGL // no support with GTK3
-#endif
-#if defined(HAV... | Should I remove it from CMake, too? |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** samples/opengl/opengl3_2.cpp
**Change Type:** added
**Context:** PR #25822: Support OpenGL GTK3 New API
**Code Changes:**
```diff
@@ -0,0 +1,169 @@
+#include <iostream>
+
+#include <epoxy/gl.h>
+
+#ifdef _WIN32
+ #define WIN32_LEAN_AND_MEAN 1
+ #define NOMINMAX 1
+ #include <windows.h>
+#endif
``` | similar to #25635 - perhaps choose a different default file name from the https://github.com/opencv/opencv/tree/4.x/samples/data samples e.g. ```suggestion filename = "HappyFish.jpg"; ``` |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** samples/opengl/opengl3_2.cpp
**Change Type:** added
**Context:** PR #25822: Support OpenGL GTK3 New API
**Code Changes:**
```diff
@@ -0,0 +1,169 @@
+#include <iostream>
+
+#include <epoxy/gl.h>
+
+#ifdef _WIN32
+ #define WIN32_LEAN_AND_MEAN 1
+ #define NOMINMAX 1
+ #include <windows.h>
+#endif
``` | https://github.com/opencv/opencv/pull/25822/commits/174265724cb21160229b6b5591acba3526fbc261 |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/highgui/src/window_gtk.cpp
**Change Type:** modified
**Context:** PR #25822: Support OpenGL GTK3 New API
**Code Changes:**
```diff
@@ -46,10 +46,7 @@
#include <gtk/gtk.h>
-#if (GTK_MAJOR_VERSION == 3) && defined(HAVE_OPENGL)
- #undef HAVE_OPENGL // no support with GTK3
-#endif
-#if defined(HAV... | https://github.com/opencv/opencv/pull/25822/commits/b9b912ebc02e7782f602505bf9e498cbbf10bd5b |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #25822: Support OpenGL GTK3 New API
**Code Changes:**
```diff
@@ -1464,9 +1464,12 @@ if(WITH_GTK OR HAVE_GTK)
else()
status(" GTK+:" "NO")
endif()
+
if(HAVE_GTK)
status( " GThread :" HAVE_GTHREAD THEN "YES (ver ${GTHREAD_VER... | Epoxy is not needed for OpenCV itself any more. Let's drop it. |
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core/opengl.hpp
**Change Type:** modified
**Context:** PR #25822: Support OpenGL GTK3 New API
**Review Line:** 60
**Code Changes:**
```diff
@@ -57,7 +57,7 @@ This section describes OpenGL interoperability.
To enable OpenGL support, configure OpenCV using CMake with WITH_OPENGL... | I'll add the comment about `libepoxy` when I create the new wrapper for OpenGL3.2 |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/src/approx.cpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -39,6 +39,7 @@
//
//M*/
#include "precomp.hpp"
+#include <queue>
/************************... | use `int8_t` instead of `short` or use `enum class` Also suggest to rename `relevant` to `pointStatus` |
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -4060,6 +4060,28 @@ CV_EXPORTS_W void approxPolyDP( InputArray curve,
... | As soon as the implementation is base on public paper I propose to add the paper to `doc/opencv.bib` and add reference to the function description. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/src/approx.cpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -39,6 +39,7 @@
//
//M*/
#include "precomp.hpp"
+#include <queue>
/************************... | explicit? `const cv::Point2f&` |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/src/approx.cpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -39,6 +39,7 @@
//
//M*/
#include "precomp.hpp"
+#include <queue>
/************************... | Why `.type() == 0`? |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/src/approx.cpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -39,6 +39,7 @@
//
//M*/
#include "precomp.hpp"
+#include <queue>
/************************... | .t() call may happen twice. It does not make sense. |
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/src/approx.cpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -39,6 +39,7 @@
//
//M*/
#include "precomp.hpp"
+#include <queue>
/************************... | Y can just call cv::Mat::reshape() to get propoer shape for existing buffer without memory transfers. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/src/approx.cpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -39,6 +39,7 @@
//
//M*/
#include "precomp.hpp"
+#include <queue>
/************************... | What 1d+38 means? I propose to use something like FLT_MAX instead. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/src/approx.cpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -39,6 +39,7 @@
//
//M*/
#include "precomp.hpp"
+#include <queue>
/************************... | Also I propose to move the initialization for the negative case inside `recalculation` function. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/src/approx.cpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -39,6 +39,7 @@
//
//M*/
#include "precomp.hpp"
+#include <queue>
/************************... | The return type of the function matches the type **`OutputArray _approxCurve`**. However, in Python, you don't need to specify OutputArray, and its type will be zero ```_approxCurve.type() == 0```: ```python output = cv.approxBoundingPoly(contour, side=4, make_hull=True) ``` In this case the function currently uses the... |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -4060,6 +4060,28 @@ CV_EXPORTS_W void approxPolyDP( InputArray curve,
... | You can use Tex notation for references. Links are generated by doxygen automatically. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/src/approx.cpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -39,6 +39,7 @@
//
//M*/
#include "precomp.hpp"
+#include <queue>
/************************... | 0 means that output array is not created. ``` if (_approxCurve.fixedType()) { CV_Assert(...) } ``` |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/test/test_approxpoly.cpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -377,4 +377,79 @@ TEST(Imgproc_ApproxPoly, bad_epsilon)
ASSERT_ANY_THROW(approxPo... | I propose to replace the test image with something synthesized in code with drawing functions. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/test/test_approxpoly.cpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -377,4 +377,79 @@ TEST(Imgproc_ApproxPoly, bad_epsilon)
ASSERT_ANY_THROW(approxPo... | I might suggest replacing the test image with a 32 point image using **cv::polylines**. Should I reduce/increase the number of points or do something else?  Should I close the PR in opencv_extra in this case? |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #25607: Add a new function that approximates the polygon bounding a convex hull with a certain number of sides
**Code Changes:**
```diff
@@ -4060,6 +4060,28 @@ CV_EXPORTS_W void approxPolyDP( InputArray curve,
... | could you please rename: 1. approxBoundingPoly to approxPolyN 2. side to nsides 3. make_hull to ensure_convex |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/src/matrix.cpp
**Change Type:** modified
**Context:** PR #25899: Mark cv::Mat(Mat&&) as noexcept
**Review Line:** 598
**Code Changes:**
```diff
@@ -595,7 +595,7 @@ size_t Mat::total(int startDim, int endDim) const
}
-Mat::Mat(Mat&& m)
+Mat::Mat(Mat&& m) CV_NOEXCEPT
: flags(m.flags), di... | What about assertion in the else branch? ``` CV_Assert(m.step.p != m.step.buf); ``` |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/src/matrix.cpp
**Change Type:** modified
**Context:** PR #25899: Mark cv::Mat(Mat&&) as noexcept
**Review Line:** 598
**Code Changes:**
```diff
@@ -595,7 +595,7 @@ size_t Mat::total(int startDim, int endDim) const
}
-Mat::Mat(Mat&& m)
+Mat::Mat(Mat&& m) CV_NOEXCEPT
: flags(m.flags), di... | I forgot CV_Assert was more than an assert ... If it can throw, I guess it won't work indeed. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/src/matrix.cpp
**Change Type:** modified
**Context:** PR #25899: Mark cv::Mat(Mat&&) as noexcept
**Review Line:** 598
**Code Changes:**
```diff
@@ -595,7 +595,7 @@ size_t Mat::total(int startDim, int endDim) const
}
-Mat::Mat(Mat&& m)
+Mat::Mat(Mat&& m) CV_NOEXCEPT
: flags(m.flags), di... | I see, `CV_Assert` calls `cv::error` calls `throw` ([here](https://github.com/opencv/opencv/blob/4.x/modules/core/src/system.cpp#L1276)). But still, IIUC, isn't that `CV_Assert` basically asserting an _invariant?_ I mean, IIUC, you're not actually trying to use that exception for control-flow. IIUC, you expect that `(m... |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/src/matrix.cpp
**Change Type:** modified
**Context:** PR #25899: Mark cv::Mat(Mat&&) as noexcept
**Review Line:** 598
**Code Changes:**
```diff
@@ -595,7 +595,7 @@ size_t Mat::total(int startDim, int endDim) const
}
-Mat::Mat(Mat&& m)
+Mat::Mat(Mat&& m) CV_NOEXCEPT
: flags(m.flags), di... | Actually, why even modify `m`? `m` is moved so there is not point in modifying it. `Move constructors typically "steal" the resources held by the argument (e.g. pointers to dynamically-allocated objects, file descriptors, TCP sockets, I/O streams, running threads, etc.) rather than make copies of them, and leave the ar... |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/src/matrix.cpp
**Change Type:** modified
**Context:** PR #25899: Mark cv::Mat(Mat&&) as noexcept
**Review Line:** 598
**Code Changes:**
```diff
@@ -595,7 +595,7 @@ size_t Mat::total(int startDim, int endDim) const
}
-Mat::Mat(Mat&& m)
+Mat::Mat(Mat&& m) CV_NOEXCEPT
: flags(m.flags), di... | > why even modify `m` It is modified to transfer ownership of allocated metadata buffers. To avoid use-after-free when `m` destructor is called. > CV_Assert Basically it checks `invariant` and should never fail. I believe we could replace failure handling code with `abort()` / `std::terminate()`. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/core/include/opencv2/core/base.hpp
**Change Type:** modified
**Context:** PR #25899: Mark cv::Mat(Mat&&) as noexcept
**Code Changes:**
```diff
@@ -297,6 +297,21 @@ It is possible to alternate error processing by using redirectError().
*/
CV_EXPORTS CV_NORETURN void error(int _code, const String& _... | CV_AssertTerminate |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | Can we just remove this assert? |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | `preprocess` should be applied only if `CV_8U` is present - image case This is how I would expect it to work: ``` // no assert here if (src.depth() != CV_8U) { // Just pass the tensor as-is logic } else { // 8U input: full preprocessing path } ``` |
You are an expert OpenCV code reviewer specializing in API design and compatibility. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | But exception message still only about `FP32` and `U8`. Btw, all types supported in ONNXRT: https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/session/onnxruntime_c_api.h#L177-L203 We also need to cover `_INT64` |
You are an expert OpenCV code reviewer specializing in API design and compatibility. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | To cover `_INT64` we also need handling here: https://github.com/opencv/opencv/blob/762ac0f2f394cdbc2837be5ee0735d0812997156/modules/gapi/src/backends/onnx/gonnxbackend.cpp#L467-L474 |
You are an expert OpenCV code reviewer specializing in API design and compatibility. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | Note, that there is not `CV_I64` type, in such case we usually apply WA and upcast data from `CV_32` cv::Mat to `int64_t`. Here is example from OpenVINO backend: https://github.com/opencv/opencv/blob/4.x/modules/gapi/src/backends/ov/govbackend.cpp#L144-L146 |
You are an expert OpenCV code reviewer specializing in API design and compatibility. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Review Line:** 332
**Code Changes:**
```diff
// Just pass the tensor as-is.
// No layout or dimension transformations done here!
//... | What about this: https://github.com/opencv/opencv/blob/f8ffdae050bc329a1101fb4a05279ad417dc1d55/modules/gapi/src/backends/onnx/gonnxbackend.cpp#L335? Still refers only to `FP32`, can be at least not `U8`? |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Review Line:** 332
**Code Changes:**
```diff
// Just pass the tensor as-is.
// No layout or dimension transformations done here!
//... | you're right, will change this now |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | Could you point me where this conversion is carried out? Couldn't find it... |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | Return back the previous format |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | and here, format seems to be changed |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | can we get rid of extra vector? |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | debug prints |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | well maybe `i64_tensor` better? |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | I have this changed now |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | this is fixed now |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | reverted to original format now |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | currently using this tensor to store the converted tensors when running the convertInt32ToInt64 which will then be used to deep copy it into "i64_tensor" |
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Review Line:** 472
**Code Changes:**
```diff
dst = src;
@@ -471,6 +469,25 @@ inline Ort::Value createTensor(const Ort::MemoryInfo& memory_info,
... | Can we get rid of `temp` vector here? I assume `convertInt32ToInt64` can write straight to `i64_tensor` memory. You will avoid extra copy by doing this. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | Don't think we need it as a separate condition. Can we simply check as part of `else if (!is_dynamic && !is_postproc)` after `this_session.Run`? If `out_tensor_info[0].type == ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64` then we know for sure we need to copy data back otherwise it's already in-place |
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | some `NB` comment would be useful here to understand why it's needed |
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Review Line:** 472
**Code Changes:**
```diff
dst = src;
@@ -471,6 +469,25 @@ inline Ort::Value createTensor(const Ort::MemoryInfo& memory_info,
... | also some comment why we need this would be helpful |
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | redundant comment |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | I've removed it now |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/gapi/src/backends/onnx/gonnxbackend.cpp
**Change Type:** modified
**Context:** PR #25817: handling I32/I64 data types in G-API ONNX back-end
**Code Changes:**
```diff
@@ -123,7 +123,7 @@ class ONNXCompiled {
std::vector<cv::Mat> out_data;
void Run(const std::vector<cv::Mat>& ins,
- ... | fixed alignment |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #25252: Move API focused C++ samples to snippets - Clean Samples #25006 This PR removes 39 outdated C++ samples from the project, as part of an eff...
**Review Line:** 2841
**Code Changes:**
```diff
An example using the cv... | These snippets illustrated statement before them, without snippets meaning is lost. These two paragraphs must be rewritten, maybe similar snippets could be used from other sample. |
You are an expert OpenCV code reviewer specializing in API design and compatibility. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #25252: Move API focused C++ samples to snippets - Clean Samples #25006 This PR removes 39 outdated C++ samples from the project, as part of an eff...
**Review Line:** 2841
**Code Changes:**
```diff
An example using the cv... | Completely wrong way. Samples are regularly compiled. That code in comments is not build at all. We don't want to provide broken code to users. Especially during heavy API refactoring. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** samples/cpp/dft.cpp
**Change Type:** removed
**Context:** PR #25252: Move API focused C++ samples to snippets - Clean Samples #25006 This PR removes 39 outdated C++ samples from the project, as part of an eff...
**Review Line:** 1
**Code Changes:**
```diff
@@ -1,86 +0,0 @@
-#include "opencv2/core.hpp"
-#incl... | `cv::dft()` has code snipped, but it's embedded into header. It means that it's not built by CI. I propose to move the file to snippets, but change it's content to `convolveDFT` from core.hpp header file. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/dnn/src/layers/elementwise_layers.cpp
**Change Type:** modified
**Context:** PR #25147: dnn: accelerate gelu via vectorized erf
**Code Changes:**
```diff
@@ -813,20 +813,82 @@ struct BaseDefaultFunctor : public BaseFunctor
static const char* const ocl_kernel_name;
};
-struct GeluFunctor : pub... | please, use fabsf, fmaf, expf, otherwise compiler will use double precision for intermediate values |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/dnn/src/layers/elementwise_layers.cpp
**Change Type:** modified
**Context:** PR #25147: dnn: accelerate gelu via vectorized erf
**Code Changes:**
```diff
@@ -813,20 +813,82 @@ struct BaseDefaultFunctor : public BaseFunctor
static const char* const ocl_kernel_name;
};
-struct GeluFunctor : pub... | I suggest not to use pytorch_math namespace, because it may look confusing. It's enough to put the link to PyTorch code and use v_erf without any namespace (just use cv, cv::hal or cv::dnn) |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/dnn/src/layers/elementwise_layers.cpp
**Change Type:** modified
**Context:** PR #25147: dnn: accelerate gelu via vectorized erf
**Code Changes:**
```diff
@@ -813,20 +813,82 @@ struct BaseDefaultFunctor : public BaseFunctor
static const char* const ocl_kernel_name;
};
-struct GeluFunctor : pub... | please, put a short description that we took this algorithm in Wikipedia and it's also implemented in PyTorch, provide the link. |
You are an expert OpenCV code reviewer specializing in performance optimization. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/dnn/src/layers/elementwise_layers.cpp
**Change Type:** modified
**Context:** PR #25147: dnn: accelerate gelu via vectorized erf
**Code Changes:**
```diff
@@ -813,20 +813,82 @@ struct BaseDefaultFunctor : public BaseFunctor
static const char* const ocl_kernel_name;
};
-struct GeluFunctor : pub... | it's quite heavy function inside. 1) does it make sense to unroll the loop by vlanes*4? 2) with such aggressive unrolling there is a risk that we will have very long tail which will slow down performance significantly. I suggest to make unrolling less aggressive. 2) it's element-wise operation. Often in NCHW the produc... |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/dnn/src/layers/elementwise_layers.cpp
**Change Type:** modified
**Context:** PR #25147: dnn: accelerate gelu via vectorized erf
**Code Changes:**
```diff
@@ -813,20 +813,82 @@ struct BaseDefaultFunctor : public BaseFunctor
static const char* const ocl_kernel_name;
};
-struct GeluFunctor : pub... | Ok, anonymous namespace is used. In this case, `erf` needs to be changed to `erf_approx` to avoid redef of the one from std library. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/dnn/src/layers/elementwise_layers.cpp
**Change Type:** modified
**Context:** PR #25147: dnn: accelerate gelu via vectorized erf
**Code Changes:**
```diff
@@ -813,20 +813,82 @@ struct BaseDefaultFunctor : public BaseFunctor
static const char* const ocl_kernel_name;
};
-struct GeluFunctor : pub... | This is from PyTorch. A link to the source has been provided next line to the namespace. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/dnn/src/layers/elementwise_layers.cpp
**Change Type:** modified
**Context:** PR #25147: dnn: accelerate gelu via vectorized erf
**Code Changes:**
```diff
@@ -813,20 +813,82 @@ struct BaseDefaultFunctor : public BaseFunctor
static const char* const ocl_kernel_name;
};
-struct GeluFunctor : pub... | I tested with unrolling by 2 but did not observe significant difference. --- > You should process (cn1-cn0)*planeSize as a single 1D array, so that you will have just one tail, not many tiles It is not completely correct. The loops and parallel look like the following: ``` for b in batch: for c in channel: for i in h *... |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/dnn/perf/perf_layer.cpp
**Change Type:** modified
**Context:** PR #25147: dnn: accelerate gelu via vectorized erf
**Review Line:** 1020
**Code Changes:**
```diff
+ /* withCpuOCV= */ true,
+ /* withVkCom= */ false,
+ ... | M.b. we need to enable ngraph and opencl? |
You are an expert OpenCV code reviewer specializing in code quality and best practices. Review the provided code changes and provide specific, actionable feedback. | **File:** cmake/OpenCVFindLibsGUI.cmake
**Change Type:** modified
**Context:** PR #22836: Explicitly prefer legacy GL in cmake on Linux?
**Code Changes:**
```diff
@@ -60,6 +60,7 @@ if(WITH_QT)
endif()
# --- OpenGl ---
+ocv_update(OpenGL_GL_PREFERENCE LEGACY)
ocv_clear_vars(HAVE_OPENGL HAVE_QT_OPENGL)
if(WITH_OPE... | `ocv_update` is preferable to allow external control. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/dnn/src/registry.cpp
**Change Type:** modified
**Context:** PR #25880: π Fix CUDA for old GPUs without FP16 support
**Code Changes:**
```diff
@@ -18,6 +18,10 @@
#include "backend.hpp"
#include "factory.hpp"
+#ifdef HAVE_CUDA
+#include "cuda4dnn/init.hpp"
+#endif
+
namespace cv {
namespace dnn ... | It works well with single gpu configuration. The current GPU may be old and does not support FP16, but the second one does. It's popular case, if one GPU is used for rendering another one - for compute. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/dnn/src/registry.cpp
**Change Type:** modified
**Context:** PR #25880: π Fix CUDA for old GPUs without FP16 support
**Code Changes:**
```diff
@@ -18,6 +18,10 @@
#include "backend.hpp"
#include "factory.hpp"
+#ifdef HAVE_CUDA
+#include "cuda4dnn/init.hpp"
+#endif
+
namespace cv {
namespace dnn ... | It is fine to check the **CURRENT** CUDA device. Lets left the caller responsibility to properly select used device via `cudaSetDevice` before these calls. BTW, OpenCL backend has similar problems but looks like they are handled in another place. |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/dnn/src/registry.cpp
**Change Type:** modified
**Context:** PR #25880: π Fix CUDA for old GPUs without FP16 support
**Review Line:** 136
**Code Changes:**
```diff
+ if (cuda4dnn::isDeviceCompatible(i))
+ {
+ hasCudaCompatible = true;
+ if (cuda4dnn... | There's no need to continue checking GPUs once we found one that supports FP16. ```suggestion { hasCudaFP16 = true; break; // we already have all we need here } ``` |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/dnn/src/cuda4dnn/init.hpp
**Change Type:** modified
**Context:** PR #25880: π Fix CUDA for old GPUs without FP16 support
**Review Line:** 94
**Code Changes:**
```diff
int version = major * 10 + minor;
- if (version < 53)
- return false;
- return true;
+ ret... | Taking into account that the `version` is an integer variable, I think it would be a bit cleaner if we use `> 52` for this check. ```suggestion return (version > 52); ``` |
You are an expert OpenCV code reviewer specializing in header file design and interface. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/dnn/src/cuda4dnn/init.hpp
**Change Type:** modified
**Context:** PR #25880: π Fix CUDA for old GPUs without FP16 support
**Review Line:** 94
**Code Changes:**
```diff
int version = major * 10 + minor;
- if (version < 53)
- return false;
- return true;
+ ret... | I prefer to stay with 53. It's well known constant in CUDA world. Also it's easier to "grep". |
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/test/test_color.cpp
**Change Type:** modified
**Context:** PR #25842: imgproc: remove C-API usage from tests - Final cleanup will be done in 5.x after regular merge. Some tests have been reworked, some require...
**Review Line:** 1733
**Code Changes:**
```diff
@@ -76,7 +76,6 @@ class CV_Color... | The flag may be removed then. |
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback. | **File:** modules/imgproc/test/test_imgwarp.cpp
**Change Type:** modified
**Context:** PR #25842: imgproc: remove C-API usage from tests - Final cleanup will be done in 5.x after regular merge. Some tests have been reworked, some require...
**Review Line:** 928
**Code Changes:**
```diff
bool test_cpp;
};
@@ -9... | `test_cpp` could be removed then |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.