instruction
stringclasses 9
values | input
stringlengths 279
5.47k
| output
stringlengths 6
9.58k
|
|---|---|---|
You are an expert OpenCV code reviewer specializing in performance optimization. Review the provided code changes and provide specific, actionable feedback.
|
**File:** 3rdparty/fastcv/src/fastcv_hal_imgproc.cpp
**Change Type:** modified
**Context:** PR #27036: Fix gaussianBlur5x5 performance regression in FastCV HAL
**Review Line:** 562
**Code Changes:**
```diff
+ cv::Mat dst = cv::Mat(height, width, CV_8UC1, (void *)dst_data, dst_step);
+ cv::Mat src_tmp = cv::Mat(height + ksize - 1, width + ksize - 1, CV_8UC1);
+ cv::Mat dst_tmp = cv::Mat(height + ksize - 1, width + ksize - 1, CV_8UC1);
+ cv::copyMakeBorder(src, src_tmp, ksize / 2, ksize / 2, ksize / 2, ksize / 2, border_type);
+ cv::parallel_for_(cv::Range(0, height), FcvGaussianBlurLoop_Invoker(src_tmp, dst_tmp, ksize, border_type, 0), nStripes);
+ dst_tmp(cv::Rect(ksize / 2, ksize / 2, width, height)).copyTo(dst);
break;
}
default:
```
|
The patch adds 2 memory copies: - src + bodrder - dst_tmp -> dst. It should significantly affect performance.
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** 3rdparty/fastcv/src/fastcv_hal_imgproc.cpp
**Change Type:** modified
**Context:** PR #27036: Fix gaussianBlur5x5 performance regression in FastCV HAL
**Review Line:** 562
**Code Changes:**
```diff
+ cv::Mat dst = cv::Mat(height, width, CV_8UC1, (void *)dst_data, dst_step);
+ cv::Mat src_tmp = cv::Mat(height + ksize - 1, width + ksize - 1, CV_8UC1);
+ cv::Mat dst_tmp = cv::Mat(height + ksize - 1, width + ksize - 1, CV_8UC1);
+ cv::copyMakeBorder(src, src_tmp, ksize / 2, ksize / 2, ksize / 2, ksize / 2, border_type);
+ cv::parallel_for_(cv::Range(0, height), FcvGaussianBlurLoop_Invoker(src_tmp, dst_tmp, ksize, border_type, 0), nStripes);
+ dst_tmp(cv::Rect(ksize / 2, ksize / 2, width, height)).copyTo(dst);
break;
}
default:
```
|
Checked perf numbers. Looks good.
|
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/OpenCVDetectCXXCompiler.cmake
**Change Type:** modified
**Context:** PR #27107: build: Check supported C++ standard features and user setting
**Code Changes:**
```diff
@@ -207,30 +207,35 @@ if(CMAKE_VERSION VERSION_LESS "3.1")
endforeach()
endif()
+# See https://github.com/opencv/opencv/issues/27105
+# - CMAKE_COMPILE_FEATURES is used to detect what features are available by the compiler.
+# - CMAKE_CXX_STANDARD is used to detect what features are available in this configuration.
if(NOT OPENCV_SKIP_CMAKE_CXX_STANDARD)
+ if(DEFINED CMAKE_CXX_STANDARD AND ((CMAKE_CXX_STANDARD EQUAL 98) OR (CMAKE_CXX_STANDARD LESS 11)))
+ message(FATAL_ERROR "OpenCV 4.x requires C++11, but your configuration does not enable(CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}).")
```
|
Could we eliminate handling of C++98 in our scripts? (which we don't need actually) Using checks for C++11 and C++17 is more relevant.
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/calib3d/test/test_solvepnp_ransac.cpp
**Change Type:** modified
**Context:** PR #27185: Specify DLS and UPnP mappings to EPnP in all places for solvePnP* tests
**Code Changes:**
```diff
@@ -182,9 +182,9 @@ static std::string printMethod(int method)
case 2:
return "SOLVEPNP_P3P";
case 3:
- return "SOLVEPNP_DLS (remaped to SOLVEPNP_EPNP)";
+ return "SOLVEPNP_DLS (remapped to SOLVEPNP_EPNP)";
case 4:
- return "SOLVEPNP_UPNP (remaped to SOLVEPNP_EPNP)";
+ return "SOLVEPNP_UPNP (remapped to SOLVEPNP_EPNP)";
case 5:
```
|
Please do not touch not related code or just removed the dead part.
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/calib3d/test/test_solvepnp_ransac.cpp
**Change Type:** modified
**Context:** PR #27185: Specify DLS and UPnP mappings to EPnP in all places for solvePnP* tests
**Code Changes:**
```diff
@@ -182,9 +182,9 @@ static std::string printMethod(int method)
case 2:
return "SOLVEPNP_P3P";
case 3:
- return "SOLVEPNP_DLS (remaped to SOLVEPNP_EPNP)";
+ return "SOLVEPNP_DLS (remapped to SOLVEPNP_EPNP)";
case 4:
- return "SOLVEPNP_UPNP (remaped to SOLVEPNP_EPNP)";
+ return "SOLVEPNP_UPNP (remapped to SOLVEPNP_EPNP)";
case 5:
```
|
The same here and above.
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1340
**Code Changes:**
```diff
+ cv::OutputArray C(A);
+ cv::Mat B = C.reinterpret(CV_32FC1);
+
+ EXPECT_EQ(A.data, B.data);
+ EXPECT_EQ(B.type(), CV_32FC1);
+}
+
TEST(Core_Mat, push_back)
{
Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```
|
Please also check the following case with existing reference ```cpp cv::Mat A(8, 16, CV_8UC3, cv::Scalar(1, 2, 3)); cv::Mat B = A; A.convertTo(A, CV_8SC3); ```
|
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1340
**Code Changes:**
```diff
+ cv::OutputArray C(A);
+ cv::Mat B = C.reinterpret(CV_32FC1);
+
+ EXPECT_EQ(A.data, B.data);
+ EXPECT_EQ(B.type(), CV_32FC1);
+}
+
TEST(Core_Mat, push_back)
{
Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```
|
I have got your idea, in this case, A still need to allocate new memory.
|
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/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1340
**Code Changes:**
```diff
+ cv::OutputArray C(A);
+ cv::Mat B = C.reinterpret(CV_32FC1);
+
+ EXPECT_EQ(A.data, B.data);
+ EXPECT_EQ(B.type(), CV_32FC1);
+}
+
TEST(Core_Mat, push_back)
{
Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```
|
Agree. So let's add a test case too.
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1340
**Code Changes:**
```diff
+ cv::OutputArray C(A);
+ cv::Mat B = C.reinterpret(CV_32FC1);
+
+ EXPECT_EQ(A.data, B.data);
+ EXPECT_EQ(B.type(), CV_32FC1);
+}
+
TEST(Core_Mat, push_back)
{
Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```
|
OK, I added a check for the reference count in the convertTo function.
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1340
**Code Changes:**
```diff
+ cv::OutputArray C(A);
+ cv::Mat B = C.reinterpret(CV_32FC1);
+
+ EXPECT_EQ(A.data, B.data);
+ EXPECT_EQ(B.type(), CV_32FC1);
+}
+
TEST(Core_Mat, push_back)
{
Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```
|
I think just better to highlight final types and data ptrs: ``` A.type == new_type B.type == old_type A.data_ptr != B.data_ptr ```
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Code Changes:**
```diff
@@ -1303,6 +1303,42 @@ TEST(Core_Mat, reshape_ndims_4)
}
}
+TEST(Core_Mat, reinterpret_Mat_8UC3_8SC3)
+{
+ cv::Mat A(8, 16, CV_8UC3, cv::Scalar(1, 2, 3));
+ cv::Mat B = A.reinterpret(CV_8SC3);
+
+ EXPECT_EQ(A.data, B.data);
```
|
`int cn = A.channels();`
|
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/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Code Changes:**
```diff
@@ -1303,6 +1303,42 @@ TEST(Core_Mat, reshape_ndims_4)
}
}
+TEST(Core_Mat, reinterpret_Mat_8UC3_8SC3)
+{
+ cv::Mat A(8, 16, CV_8UC3, cv::Scalar(1, 2, 3));
+ cv::Mat B = A.reinterpret(CV_8SC3);
+
+ EXPECT_EQ(A.data, B.data);
```
|
Split test cases to different with proper naming: ``` TEST(Core_Mat, convertTo_inplace_8UC3_8SC3) ``` ``` TEST(Core_Mat, convertTo_inplace_8UC3_32FC3) ```
|
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/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1341
**Code Changes:**
```diff
+ cv::Mat B = C.reinterpret(CV_32FC1);
+
+ EXPECT_EQ(A.data, B.data);
+ EXPECT_EQ(B.type(), CV_32FC1);
+}
+
TEST(Core_Mat, push_back)
{
Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```
|
Can you please also add a test for `CV_8UC4->CV_32FC1` inplace conversion expecting that it will keep memory?
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1341
**Code Changes:**
```diff
+ cv::Mat B = C.reinterpret(CV_32FC1);
+
+ EXPECT_EQ(A.data, B.data);
+ EXPECT_EQ(B.type(), CV_32FC1);
+}
+
TEST(Core_Mat, push_back)
{
Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```
|
Yes, I can. But convertTo only supports cases where the number of channels in the (src) and (dst) are the same. Currently, I'm unable to think of any function supporting the conversion from CV_8UC4 to CV_32FC1.
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Code Changes:**
```diff
@@ -1303,6 +1303,42 @@ TEST(Core_Mat, reshape_ndims_4)
}
}
+TEST(Core_Mat, reinterpret_Mat_8UC3_8SC3)
+{
+ cv::Mat A(8, 16, CV_8UC3, cv::Scalar(1, 2, 3));
+ cv::Mat B = A.reinterpret(CV_8SC3);
+
+ EXPECT_EQ(A.data, B.data);
```
|
Add a check for resulting values: ```cpp EXPECT_EQ(0, countNonZero(A != cv::Scalar(1, 2, 3))); ```
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Code Changes:**
```diff
@@ -1303,6 +1303,42 @@ TEST(Core_Mat, reshape_ndims_4)
}
}
+TEST(Core_Mat, reinterpret_Mat_8UC3_8SC3)
+{
+ cv::Mat A(8, 16, CV_8UC3, cv::Scalar(1, 2, 3));
+ cv::Mat B = A.reinterpret(CV_8SC3);
+
+ EXPECT_EQ(A.data, B.data);
```
|
I had add a function to replace countNonZero, because countNonZero only support cn == 1.
|
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 #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Code Changes:**
```diff
@@ -1261,6 +1261,16 @@ Mat Mat::reshape(int _cn, const std::vector<int>& _newshape) const
return reshape(_cn, (int)_newshape.size(), &_newshape[0]);
}
+Mat Mat::reinterpret(int type) const
+{
+ type = CV_MAT_TYPE(type);
+ CV_Assert(CV_ELEM_SIZE(this->type()) == CV_ELEM_SIZE(type));
+ Mat m = *this;
+ m.flags = (m.flags & ~CV_MAT_TYPE_MASK) | type;
```
|
it's safer to use `m.flags = (m.flags & ~CV_MAT_TYPE_MASK) | type;` here.
|
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_wrap.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Code Changes:**
```diff
@@ -1656,6 +1656,12 @@ void _OutputArray::create(int d, const int* sizes, int mtype, int i,
CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type");
}
+Mat _OutputArray::reinterpret(int mtype) const
+{
+ mtype = CV_MAT_TYPE(mtype);
+ return getMat().reinterpret(mtype);
+}
+
```
|
don't silently assume that `obj` is `Mat*`. Do `return getMat().reinterpretType(mtype);` 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/mat.hpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Code Changes:**
```diff
@@ -371,6 +371,7 @@ class CV_EXPORTS _OutputArray : public _InputArray
void release() const;
void clear() const;
void setTo(const _InputArray& value, const _InputArray & mask = _InputArray()) const;
+ Mat reinterpret( int type ) const;
void assign(const UMat& u) const;
void assign(const Mat& m) const;
@@ -1322,6 +1323,15 @@ class CV_EXPORTS Mat
*/
```
|
can we skip `Type` suffix in the name? (`Mat reinterpret(int type) const;`?)
|
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 #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1266
**Code Changes:**
```diff
return reshape(_cn, (int)_newshape.size(), &_newshape[0]);
}
+Mat Mat::reinterpret(int type) const
+{
+ type = CV_MAT_TYPE(type);
+ CV_Assert(CV_ELEM_SIZE(this->type()) == CV_ELEM_SIZE(type));
+ Mat m = *this;
+ m.flags = (m.flags & ~CV_MAT_TYPE_MASK) | type;
+ m.updateContinuityFlag();
+ return m;
```
|
Why do we need `CV_MAT_TYPE` operation?
|
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 #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1266
**Code Changes:**
```diff
return reshape(_cn, (int)_newshape.size(), &_newshape[0]);
}
+Mat Mat::reinterpret(int type) const
+{
+ type = CV_MAT_TYPE(type);
+ CV_Assert(CV_ELEM_SIZE(this->type()) == CV_ELEM_SIZE(type));
+ Mat m = *this;
+ m.flags = (m.flags & ~CV_MAT_TYPE_MASK) | type;
+ m.updateContinuityFlag();
+ return m;
```
|
I want to retrieve the actual type of the cv::Mat to prevent users from passing incorrect parameters, and then perform an assertion check.
|
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 #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1266
**Code Changes:**
```diff
return reshape(_cn, (int)_newshape.size(), &_newshape[0]);
}
+Mat Mat::reinterpret(int type) const
+{
+ type = CV_MAT_TYPE(type);
+ CV_Assert(CV_ELEM_SIZE(this->type()) == CV_ELEM_SIZE(type));
+ Mat m = *this;
+ m.flags = (m.flags & ~CV_MAT_TYPE_MASK) | type;
+ m.updateContinuityFlag();
+ return m;
```
|
Need to start with "bad param" test then. Silent ignoring of invalid input doesn't look good.
|
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 #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1266
**Code Changes:**
```diff
return reshape(_cn, (int)_newshape.size(), &_newshape[0]);
}
+Mat Mat::reinterpret(int type) const
+{
+ type = CV_MAT_TYPE(type);
+ CV_Assert(CV_ELEM_SIZE(this->type()) == CV_ELEM_SIZE(type));
+ Mat m = *this;
+ m.flags = (m.flags & ~CV_MAT_TYPE_MASK) | type;
+ m.updateContinuityFlag();
+ return m;
```
|
I had added assert checks `CV_Assert(CV_ELEM_SIZE(this->type()) == CV_ELEM_SIZE(type));` Surely, I will add test cases, and should I create a new PR to update this issue?
|
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 #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1266
**Code Changes:**
```diff
return reshape(_cn, (int)_newshape.size(), &_newshape[0]);
}
+Mat Mat::reinterpret(int type) const
+{
+ type = CV_MAT_TYPE(type);
+ CV_Assert(CV_ELEM_SIZE(this->type()) == CV_ELEM_SIZE(type));
+ Mat m = *this;
+ m.flags = (m.flags & ~CV_MAT_TYPE_MASK) | type;
+ m.updateContinuityFlag();
+ return m;
```
|
It is still not clear why do we need `type = CV_MAT_TYPE(type)` operation: - it is useless for valid MatType (works as no-op). - it silently ignores invalid out-of-range input converting/truncating it to some value (which user may not expect).
|
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 #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1266
**Code Changes:**
```diff
return reshape(_cn, (int)_newshape.size(), &_newshape[0]);
}
+Mat Mat::reinterpret(int type) const
+{
+ type = CV_MAT_TYPE(type);
+ CV_Assert(CV_ELEM_SIZE(this->type()) == CV_ELEM_SIZE(type));
+ Mat m = *this;
+ m.flags = (m.flags & ~CV_MAT_TYPE_MASK) | type;
+ m.updateContinuityFlag();
+ return m;
```
|
My initial thought was that types with the same element size could perform a reinterpret operation, and for any other type, an assert operation would be executed. Your point seems to be: When newtype < this->type, a reinterpret operation (truncate) can also be performed. When newtype > this->type, a new mat (convert) should be created. The CV_MAT_TYPE operation is indeed redundant, as these operations are actually the responsibility of the convertTo function. CV_MAT_TYPE is indeed unnecessary.
|
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback.
|
**File:** 3rdparty/hal_rvv/hal_rvv_1p0/warp.hpp
**Change Type:** added
**Context:** PR #27119: Add RISC-V HAL implementation for cv::warp series
**Code Changes:**
```diff
@@ -0,0 +1,1208 @@
+// 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) 2025, Institute of Software, Chinese Academy of Sciences.
+
+#ifndef OPENCV_HAL_RVV_WARP_HPP_INCLUDED
+#define OPENCV_HAL_RVV_WARP_HPP_INCLUDED
+
```
|
Why do you use assembly? Assembly injection disappoints compiler, because it cannot apply a lot of optimization solutions. I propose to get rid of it, if it's possible, or at least add a comment why if it's really 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:** 3rdparty/hal_rvv/hal_rvv_1p0/warp.hpp
**Change Type:** added
**Context:** PR #27119: Add RISC-V HAL implementation for cv::warp series
**Code Changes:**
```diff
@@ -0,0 +1,1208 @@
+// 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) 2025, Institute of Software, Chinese Academy of Sciences.
+
+#ifndef OPENCV_HAL_RVV_WARP_HPP_INCLUDED
+#define OPENCV_HAL_RVV_WARP_HPP_INCLUDED
+
```
|
Why do you use assembly? Assembly injection disappoints compiler, because it cannot apply a lot of optimization solutions. I propose to get rid of it, if it's possible, or at least add a comment why if it's really needed.
|
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:** 3rdparty/hal_rvv/hal_rvv_1p0/warp.hpp
**Change Type:** added
**Context:** PR #27119: Add RISC-V HAL implementation for cv::warp series
**Code Changes:**
```diff
@@ -0,0 +1,1208 @@
+// 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) 2025, Institute of Software, Chinese Academy of Sciences.
+
+#ifndef OPENCV_HAL_RVV_WARP_HPP_INCLUDED
+#define OPENCV_HAL_RVV_WARP_HPP_INCLUDED
+
```
|
The same on asm.
|
You are an expert OpenCV code reviewer specializing in API design and compatibility. Review the provided code changes and provide specific, actionable feedback.
|
**File:** 3rdparty/hal_rvv/hal_rvv_1p0/warp.hpp
**Change Type:** added
**Context:** PR #27119: Add RISC-V HAL implementation for cv::warp series
**Code Changes:**
```diff
@@ -0,0 +1,1208 @@
+// 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) 2025, Institute of Software, Chinese Academy of Sciences.
+
+#ifndef OPENCV_HAL_RVV_WARP_HPP_INCLUDED
+#define OPENCV_HAL_RVV_WARP_HPP_INCLUDED
+
```
|
RVV 1.0 does not provide C interface to rounding down, this asm cannot be avoided.
|
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/src/norm.simd.hpp
**Change Type:** modified
**Context:** PR #27068: 5.x merge 4.x: vectorized normDiff
**Code Changes:**
```diff
@@ -11,10 +11,12 @@
namespace cv {
using NormFunc = int (*)(const uchar*, const uchar*, uchar*, int, int);
+using NormDiffFunc = int (*)(const uchar*, const uchar*, const uchar*, uchar*, int, int);
CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN
NormFunc getNormFunc(int normType, int depth);
+NormDiffFunc getNormDiffFunc(int normType, int depth);
```
|
It needs to be backported to 4.x.
|
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/src/norm.simd.hpp
**Change Type:** modified
**Context:** PR #27068: 5.x merge 4.x: vectorized normDiff
**Code Changes:**
```diff
@@ -11,10 +11,12 @@
namespace cv {
using NormFunc = int (*)(const uchar*, const uchar*, uchar*, int, int);
+using NormDiffFunc = int (*)(const uchar*, const uchar*, const uchar*, uchar*, int, int);
CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN
NormFunc getNormFunc(int normType, int depth);
+NormDiffFunc getNormDiffFunc(int normType, int depth);
```
|
Maybe no. Branch 4.x uses `std::abs(src1[j] - src2[j])` already.
|
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/calib3d/test/test_solvepnp_ransac.cpp
**Change Type:** modified
**Context:** PR #27174: More elegant skipping SOLVEPNP_IPPE* methods in non-planar accuracy tests for solvePnP*
**Review Line:** 396
**Code Changes:**
```diff
+ {
+ cout << "mode: " << printMode(mode) << ", method: " << printMethod(method) << " -> "
+ << "Skip for non-planar tag object" << endl;
+ continue;
+ }
+
//To get the same input for each methods
RNG rngCopy = rng;
std::vector<double> vec_errorTrans, vec_errorRot;
@@ -486,15 +497,6 @@ class CV_solvePnP_Test : public CV_solvePnPRansac_Test
protected:
```
|
It's even better to throw `SkipTestException`. It's handled by test system.
|
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/calib3d/test/test_solvepnp_ransac.cpp
**Change Type:** modified
**Context:** PR #27174: More elegant skipping SOLVEPNP_IPPE* methods in non-planar accuracy tests for solvePnP*
**Review Line:** 396
**Code Changes:**
```diff
+ {
+ cout << "mode: " << printMode(mode) << ", method: " << printMethod(method) << " -> "
+ << "Skip for non-planar tag object" << endl;
+ continue;
+ }
+
//To get the same input for each methods
RNG rngCopy = rng;
std::vector<double> vec_errorTrans, vec_errorRot;
@@ -486,15 +497,6 @@ class CV_solvePnP_Test : public CV_solvePnPRansac_Test
protected:
```
|
Here one test is for many methods, so it seems that throwing exception will abort whole test and following methods will not be tested
|
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/objdetect/test/test_arucodetection.cpp
**Change Type:** modified
**Context:** PR #27079: Add test for ArucoDetector::detectMarkers
**Code Changes:**
```diff
@@ -650,6 +650,40 @@ TEST(CV_ArucoDetectMarkers, regression_contour_24220)
}
}
+TEST(CV_ArucoDetectMarkers, regression_26922)
+{
+ const auto arucoDict = aruco::getPredefinedDictionary(aruco::DICT_4X4_1000);
+ const aruco::GridBoard gridBoard(Size(19, 10), 1, 0.25, arucoDict);
+
+ const Size imageSize(7200, 3825);
```
|
Please add comment that markers with id 76 and 172 are on border and should not be detected. It's not obvious expectation.
|
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
|
**File:** 3rdparty/hal_rvv/hal_rvv_1p0/norm.hpp
**Change Type:** modified
**Context:** PR #27115: core: refactored normDiff in hal_rvv and extended with support of more data types
**Code Changes:**
```diff
@@ -166,7 +166,7 @@ struct NormL1_RVV<uchar, int> {
for (int i = 0; i < n; i += vl) {
vl = __riscv_vsetvl_e8m8(n - i);
auto v = __riscv_vle8_v_u8m8(src + i, vl);
- s = __riscv_vwredsumu(__riscv_vwredsumu_tu(zero, v, zero, vl), s, vl);
+ s = __riscv_vwredsumu(__riscv_vwredsumu_tu(zero, v, zero, vl), s, __riscv_vsetvlmax_e16m1());
}
return __riscv_vmv_x(s);
}
@@ -181,7 +181,7 @@ struct NormL1_RVV<schar, int> {
```
|
I propose to add assert for `elem_size_tab[depth]` before usage. Just to highlight issue, if table is not complete or data type is unexpected.
|
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
|
**File:** 3rdparty/hal_rvv/hal_rvv_1p0/norm_diff.hpp
**Change Type:** modified
**Context:** PR #27115: core: refactored normDiff in hal_rvv and extended with support of more data types
**Code Changes:**
```diff
@@ -1,606 +1,1216 @@
// 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) 2025, Institute of Software, Chinese Academy of Sciences.
+// Copyright (C) 2025, SpaceMIT Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
```
|
The same proposal with assert elem_size_tab[depth].
|
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/src/norm.simd.hpp
**Change Type:** modified
**Context:** PR #27115: core: refactored normDiff in hal_rvv and extended with support of more data types
**Review Line:** 387
**Code Changes:**
```diff
}
s = (int)v_reduce_max(v_max(v_max(v_max(r0, r1), r2), r3));
for (; j < n; j++) {
- int v = src1[j] - src2[j];
- s = std::max(s, (int)cv_abs(v));
+ s = std::max(s, (int)std::abs(src1[j] - src2[j]));
}
return s;
}
@@ -415,8 +415,7 @@ struct NormDiffInf_SIMD<schar, int> {
}
```
|
cv_abs is "public" function and defined in modules/core/include/opencv2/core/base.hpp. It should be fixed too, in case of overflow. Why do you drop it here?
|
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
|
**File:** 3rdparty/hal_rvv/hal_rvv_1p0/norm.hpp
**Change Type:** modified
**Context:** PR #27115: core: refactored normDiff in hal_rvv and extended with support of more data types
**Code Changes:**
```diff
@@ -166,7 +166,7 @@ struct NormL1_RVV<uchar, int> {
for (int i = 0; i < n; i += vl) {
vl = __riscv_vsetvl_e8m8(n - i);
auto v = __riscv_vle8_v_u8m8(src + i, vl);
- s = __riscv_vwredsumu(__riscv_vwredsumu_tu(zero, v, zero, vl), s, vl);
+ s = __riscv_vwredsumu(__riscv_vwredsumu_tu(zero, v, zero, vl), s, __riscv_vsetvlmax_e16m1());
}
return __riscv_vmv_x(s);
}
@@ -181,7 +181,7 @@ struct NormL1_RVV<schar, int> {
```
|
Looks like the assert will be disabled in regular release builds: https://en.cppreference.com/w/cpp/error/assert. Why not just CV_Assert? It's defined in `opencv2/core/base.hpp`
|
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/3rdparty/vasot/src/components/ot/mtt/objects_associator.cpp
**Change Type:** modified
**Context:** PR #26682: Fix null pointer dereference in Tracklet by initializing rgb_feature
**Code Changes:**
```diff
@@ -141,6 +141,12 @@ ObjectsAssociator::ComputeRgbDistance(const std::vector<Detection> &detections,
if (tracking_per_class_ && (detections[d].class_label != tracklets[t]->label))
continue;
+ // Check if RGB features are available
+ auto t_rgb_features = tracklets[t]->GetRgbFeatures();
+ if (!t_rgb_features || t_rgb_features->empty()) {
+ continue; // Skip if no RGB features are available
+ }
+
```
|
Please fix indents
|
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 #26880: Initial version of IPP-based HAL for x86 and x86_64 platforms
**Review Line:** 951
**Code Changes:**
```diff
@@ -947,7 +947,15 @@ if(NOT DEFINED OpenCV_HAL)
set(OpenCV_HAL "OpenCV_HAL")
endif()
+if(HAVE_IPP)
+ ocv_debug_message(STATUS "Enable IPP acceleration")
+ if(NOT ";${OpenCV_HAL};" MATCHES ";ipp;")
+ set(OpenCV_HAL "ipp;${OpenCV_HAL}")
+ endif()
+endif()
+
```
|
> ocv_debug_message It is not visible by default. Make sense to use regular `message()` for such messages
|
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 #26880: Initial version of IPP-based HAL for x86 and x86_64 platforms
**Review Line:** 951
**Code Changes:**
```diff
@@ -947,7 +947,15 @@ if(NOT DEFINED OpenCV_HAL)
set(OpenCV_HAL "OpenCV_HAL")
endif()
+if(HAVE_IPP)
+ ocv_debug_message(STATUS "Enable IPP acceleration")
+ if(NOT ";${OpenCV_HAL};" MATCHES ";ipp;")
+ set(OpenCV_HAL "ipp;${OpenCV_HAL}")
+ endif()
+endif()
+
```
|
It's a debug message. IPP is already listed as HAL.
|
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:** 3rdparty/hal_rvv/hal_rvv.hpp
**Change Type:** modified
**Context:** PR #27046: Fix RISC-V HAL solve/SVD and BGRtoLab
**Code Changes:**
```diff
@@ -6,6 +6,7 @@
#define OPENCV_HAL_RVV_HPP_INCLUDED
#include "opencv2/core/hal/interface.h"
+#include "opencv2/imgproc/hal/interface.h"
#ifndef CV_HAL_RVV_071_ENABLED
# if defined(__GNUC__) && __GNUC__ == 10 && __GNUC_MINOR__ == 4 && defined(__THEAD_VERSION__) && defined(__riscv_v) && __riscv_v == 7000
```
|
`imgproc/include` should be added into include directories in cmake.
|
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:** 3rdparty/hal_rvv/hal_rvv_1p0/color.hpp
**Change Type:** modified
**Context:** PR #27046: Fix RISC-V HAL solve/SVD and BGRtoLab
**Review Line:** 2320
**Code Changes:**
```diff
+ static constexpr float BGR2XYZ[] =
+ {
+ 0.180423f / 0.950456f, 0.357580f / 0.950456f, 0.412453f / 0.950456f,
+ 0.072169f , 0.715160f , 0.212671f ,
+ 0.950227f / 1.088754f, 0.119193f / 1.088754f, 0.019334f / 1.088754f
+ };
static constexpr float BGR2XYZ_D65[] =
{
0.180423f, 0.357580f, 0.412453f,
0.072169f, 0.715160f, 0.212671f,
0.950227f, 0.119193f, 0.019334f
```
|
it'll be great to add reference to the values origin, if you know where they from.
|
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback.
|
**File:** 3rdparty/hal_rvv/hal_rvv_1p0/color.hpp
**Change Type:** modified
**Context:** PR #27046: Fix RISC-V HAL solve/SVD and BGRtoLab
**Review Line:** 2376
**Code Changes:**
```diff
}
}
}
// tweak
- static constexpr int error2[] = {32,-1,5246,-1,6662,-1,7837,1,8625,-1,11969,1,15290,1,19142,1,19588,1,21707,-1,22731,-1,24291,-1,25922,-1,27402,-1,28485,-1,29878,-1,32405,-1,36227,1,38265,-1,38296,1,38403,-1,41795,1,41867,1,43796,1,48096,-1,50562,-1,51054,-1,54496,1,55328,-1,56973,-1,58594,1,61568,1,66512,-1,68543,-1,68615,1,70105,-1,70692,-1,74924,1,76336,-1,78781,1,79259,-1,80855,1,81662,1,82290,-1,83208,-1,84370,1,86293,1,87263,-1,87939,-1,89942,-1,90258,-1,92101,-1,92325,-1,95244,-1,97556,1,97758,-1,97769,1,98455,1,104087,-1,106997,-1};
+ static constexpr int error2[] = {37,-1,124,-1,503,-1,4150,1,5548,1,6544,1,6659,1,8625,-1,11704,1,16108,-1,16347,-1,16446,-1,18148,1,19624,-1,22731,-1,23479,1,24001,1,24291,-1,25199,-1,25352,-1,27402,-1,28485,-1,29788,1,29807,-1,32149,-1,33451,-1,33974,-1,38265,-1,38403,-1,41038,-1,41279,1,41824,-1,42856,-1,48096,-1,49201,-1,50562,-1,51054,-1,51550,-1,51821,1,56973,-1,57283,1,62335,-1,67867,-1,70692,-1,71194,-1,71662,1,71815,1,72316,-1,73487,1,75722,-1,75959,1,82290,-1,82868,-1,83208,-1,83534,-1,84217,-1,85793,1,86683,-1,87939,-1,89143,1,90258,-1,91432,-1,92302,1,92325,-1,92572,1,93143,-1,93731,-1,94142,-1,95244,-1,96025,-1,96950,-1,97758,-1,102409,-1,104165,-1};
+ static constexpr int error3[] = {32,-1,5246,-1,6662,-1,7837,1,8625,-1,11969,1,15290,1,19142,1,19588,1,21707,-1,22731,-1,24291,-1,25922,-1,27402,-1,28485,-1,29878,-1,32405,-1,36227,1,38265,-1,38296,1,38403,-1,41795,1,41867,1,43796,1,48096,-1,50562,-1,51054,-1,54496,1,55328,-1,56973,-1,58594,1,61568,1,66512,-1,68543,-1,68615,1,70105,-1,70692,-1,74924,1,76336,-1,78781,1,79259,-1,80855,1,81662,1,82290,-1,83208,-1,84370,1,86293,1,87263,-1,87939,-1,89942,-1,90258,-1,92101,-1,92325,-1,95244,-1,97556,1,97758,-1,97769,1,98455,1,104087,-1,106997,-1};
for (size_t i = 0; i < sizeof(error2) / sizeof(int); i += 2)
- RGB2Luvprev[error2[i]] += error2[i + 1];
+ RGB2Labprev[error2[i]] += error2[i + 1];
+ for (size_t i = 0; i < sizeof(error3) / sizeof(int); i += 2)
```
|
Could you add some comment what the tweak does and why it's needed. The code bellow is very cryptic.
|
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:** 3rdparty/hal_rvv/hal_rvv_1p0/color.hpp
**Change Type:** modified
**Context:** PR #27046: Fix RISC-V HAL solve/SVD and BGRtoLab
**Code Changes:**
```diff
@@ -36,6 +36,11 @@ namespace color {
cv::parallel_for_(Range(1, height), ColorInvoker(func, std::forward<Args>(args)...), (width - 1) * height / static_cast<double>(1 << 15));
return func(0, 1, std::forward<Args>(args)...);
}
+
+ template<typename T> T rint(T val)
+ {
+ return val - std::remainder(val, 1.0);
+ }
} // cv::cv_hal_rvv::color
```
|
FYI: rint behaviour may be changed in run-time with user settings. OpenCV cannot control it. https://en.cppreference.com/w/cpp/numeric/math/rint
|
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback.
|
**File:** 3rdparty/hal_rvv/hal_rvv_1p0/color.hpp
**Change Type:** modified
**Context:** PR #27046: Fix RISC-V HAL solve/SVD and BGRtoLab
**Review Line:** 2376
**Code Changes:**
```diff
}
}
}
// tweak
- static constexpr int error2[] = {32,-1,5246,-1,6662,-1,7837,1,8625,-1,11969,1,15290,1,19142,1,19588,1,21707,-1,22731,-1,24291,-1,25922,-1,27402,-1,28485,-1,29878,-1,32405,-1,36227,1,38265,-1,38296,1,38403,-1,41795,1,41867,1,43796,1,48096,-1,50562,-1,51054,-1,54496,1,55328,-1,56973,-1,58594,1,61568,1,66512,-1,68543,-1,68615,1,70105,-1,70692,-1,74924,1,76336,-1,78781,1,79259,-1,80855,1,81662,1,82290,-1,83208,-1,84370,1,86293,1,87263,-1,87939,-1,89942,-1,90258,-1,92101,-1,92325,-1,95244,-1,97556,1,97758,-1,97769,1,98455,1,104087,-1,106997,-1};
+ static constexpr int error2[] = {37,-1,124,-1,503,-1,4150,1,5548,1,6544,1,6659,1,8625,-1,11704,1,16108,-1,16347,-1,16446,-1,18148,1,19624,-1,22731,-1,23479,1,24001,1,24291,-1,25199,-1,25352,-1,27402,-1,28485,-1,29788,1,29807,-1,32149,-1,33451,-1,33974,-1,38265,-1,38403,-1,41038,-1,41279,1,41824,-1,42856,-1,48096,-1,49201,-1,50562,-1,51054,-1,51550,-1,51821,1,56973,-1,57283,1,62335,-1,67867,-1,70692,-1,71194,-1,71662,1,71815,1,72316,-1,73487,1,75722,-1,75959,1,82290,-1,82868,-1,83208,-1,83534,-1,84217,-1,85793,1,86683,-1,87939,-1,89143,1,90258,-1,91432,-1,92302,1,92325,-1,92572,1,93143,-1,93731,-1,94142,-1,95244,-1,96025,-1,96950,-1,97758,-1,102409,-1,104165,-1};
+ static constexpr int error3[] = {32,-1,5246,-1,6662,-1,7837,1,8625,-1,11969,1,15290,1,19142,1,19588,1,21707,-1,22731,-1,24291,-1,25922,-1,27402,-1,28485,-1,29878,-1,32405,-1,36227,1,38265,-1,38296,1,38403,-1,41795,1,41867,1,43796,1,48096,-1,50562,-1,51054,-1,54496,1,55328,-1,56973,-1,58594,1,61568,1,66512,-1,68543,-1,68615,1,70105,-1,70692,-1,74924,1,76336,-1,78781,1,79259,-1,80855,1,81662,1,82290,-1,83208,-1,84370,1,86293,1,87263,-1,87939,-1,89942,-1,90258,-1,92101,-1,92325,-1,95244,-1,97556,1,97758,-1,97769,1,98455,1,104087,-1,106997,-1};
for (size_t i = 0; i < sizeof(error2) / sizeof(int); i += 2)
- RGB2Luvprev[error2[i]] += error2[i + 1];
+ RGB2Labprev[error2[i]] += error2[i + 1];
+ for (size_t i = 0; i < sizeof(error3) / sizeof(int); i += 2)
```
|
There is a comment on line 2248.
|
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback.
|
**File:** 3rdparty/hal_rvv/hal_rvv_1p0/color.hpp
**Change Type:** modified
**Context:** PR #27046: Fix RISC-V HAL solve/SVD and BGRtoLab
**Review Line:** 2320
**Code Changes:**
```diff
+ static constexpr float BGR2XYZ[] =
+ {
+ 0.180423f / 0.950456f, 0.357580f / 0.950456f, 0.412453f / 0.950456f,
+ 0.072169f , 0.715160f , 0.212671f ,
+ 0.950227f / 1.088754f, 0.119193f / 1.088754f, 0.019334f / 1.088754f
+ };
static constexpr float BGR2XYZ_D65[] =
{
0.180423f, 0.357580f, 0.412453f,
0.072169f, 0.715160f, 0.212671f,
0.950227f, 0.119193f, 0.019334f
```
|
All floating point values are copied from the cv::cvtColor series. The comments before each converting function describes it.
|
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:** 3rdparty/hal_rvv/hal_rvv_1p0/color.hpp
**Change Type:** modified
**Context:** PR #27046: Fix RISC-V HAL solve/SVD and BGRtoLab
**Code Changes:**
```diff
@@ -36,6 +36,11 @@ namespace color {
cv::parallel_for_(Range(1, height), ColorInvoker(func, std::forward<Args>(args)...), (width - 1) * height / static_cast<double>(1 << 15));
return func(0, 1, std::forward<Args>(args)...);
}
+
+ template<typename T> T rint(T val)
+ {
+ return val - std::remainder(val, 1.0);
+ }
} // cv::cv_hal_rvv::color
```
|
I will add a wrapper for this.
|
You are an expert OpenCV code reviewer specializing in documentation and code clarity. Review the provided code changes and provide specific, actionable feedback.
|
**File:** 3rdparty/hal_rvv/hal_rvv_1p0/color.hpp
**Change Type:** modified
**Context:** PR #27046: Fix RISC-V HAL solve/SVD and BGRtoLab
**Code Changes:**
```diff
@@ -36,6 +36,11 @@ namespace color {
cv::parallel_for_(Range(1, height), ColorInvoker(func, std::forward<Args>(args)...), (width - 1) * height / static_cast<double>(1 << 15));
return func(0, 1, std::forward<Args>(args)...);
}
+
+ template<typename T> T rint(T val)
+ {
+ return val - std::remainder(val, 1.0);
+ }
} // cv::cv_hal_rvv::color
```
|
The function is called in a loop many times and modifies global state. It may be slow and affect other parallel threads. I propose to revert to the original rint and add a note to header(s) and documentation about it. Also as alternative cvRound/cvFloor may be used or some other stateless function.
|
You are an expert OpenCV code reviewer specializing in performance optimization. Review the provided code changes and provide specific, actionable feedback.
|
**File:** 3rdparty/hal_rvv/hal_rvv_1p0/color.hpp
**Change Type:** modified
**Context:** PR #27046: Fix RISC-V HAL solve/SVD and BGRtoLab
**Code Changes:**
```diff
@@ -36,6 +36,11 @@ namespace color {
cv::parallel_for_(Range(1, height), ColorInvoker(func, std::forward<Args>(args)...), (width - 1) * height / static_cast<double>(1 << 15));
return func(0, 1, std::forward<Args>(args)...);
}
+
+ template<typename T> T rint(T val)
+ {
+ return val - std::remainder(val, 1.0);
+ }
} // cv::cv_hal_rvv::color
```
|
All calls to `rint` are made within the singleton initialization or static variables initialization, which has no performance penalty or thread safety issues.
|
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:** 3rdparty/hal_rvv/hal_rvv_1p0/color.hpp
**Change Type:** modified
**Context:** PR #27046: Fix RISC-V HAL solve/SVD and BGRtoLab
**Code Changes:**
```diff
@@ -36,6 +36,11 @@ namespace color {
cv::parallel_for_(Range(1, height), ColorInvoker(func, std::forward<Args>(args)...), (width - 1) * height / static_cast<double>(1 << 15));
return func(0, 1, std::forward<Args>(args)...);
}
+
+ template<typename T> T rint(T val)
+ {
+ return val - std::remainder(val, 1.0);
+ }
} // cv::cv_hal_rvv::color
```
|
I have changed to `roundeven`.
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/grfmt_gif.cpp
**Change Type:** modified
**Context:** PR #27081: GIF: Make sure to resize lzwExtraTable before each block
**Code Changes:**
```diff
@@ -320,11 +320,18 @@ bool GifDecoder::lzwDecode() {
const int lzwMaxSize = (1 << 12); // 4096 is the maximum size of the LZW table (12 bits)
int lzwCodeSize = lzwMinCodeSize + 1;
CV_Assert(lzwCodeSize > 2 && lzwCodeSize <= 12);
- int clearCode = 1 << lzwMinCodeSize;
- int exitCode = clearCode + 1;
+ const int clearCode = 1 << lzwMinCodeSize;
+ const int exitCode = clearCode + 1;
std::vector<lzwNodeD> lzwExtraTable(lzwMaxSize + 1);
- int colorTableSize = clearCode;
```
|
Why do you remove `lzwMaxSize+1` here? If I understand correctly the issue is related to exitCode state. It clears the vector and it's used after .clear() call. the vector may be used becore clearCode and it's not allocated properly.
|
You are an expert OpenCV code reviewer specializing in memory management. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/grfmt_gif.cpp
**Change Type:** modified
**Context:** PR #27081: GIF: Make sure to resize lzwExtraTable before each block
**Code Changes:**
```diff
@@ -320,11 +320,18 @@ bool GifDecoder::lzwDecode() {
const int lzwMaxSize = (1 << 12); // 4096 is the maximum size of the LZW table (12 bits)
int lzwCodeSize = lzwMinCodeSize + 1;
CV_Assert(lzwCodeSize > 2 && lzwCodeSize <= 12);
- int clearCode = 1 << lzwMinCodeSize;
- int exitCode = clearCode + 1;
+ const int clearCode = 1 << lzwMinCodeSize;
+ const int exitCode = clearCode + 1;
std::vector<lzwNodeD> lzwExtraTable(lzwMaxSize + 1);
- int colorTableSize = clearCode;
```
|
I removed it in case blockLen is 0 in the first place (not sure if that can happen), this way we have one allocation less. `clear()` is always called before using `lzwExtraTable`, at the beginning of the while loop. You are right about the issue
|
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/imgcodecs/include/opencv2/imgcodecs.hpp
**Change Type:** modified
**Context:** PR #27013: Test for in-memory animation encoding and decoding
**Review Line:** 436
**Code Changes:**
```diff
+specify additional options for the encoding process. Refer to `cv::ImwriteFlags`
+for details on possible parameters.
+
+@return Returns true if the animation was successfully encoded; returns false otherwise.
+*/
+CV_EXPORTS_W bool imencodeanimation(const String& ext, const Animation& animation, CV_OUT std::vector<uchar>& buf, const std::vector<int>& params = std::vector<int>());
+
/** @brief Returns the number of images inside the given file
The function imcount returns the number of pages in a multi-page image (e.g. TIFF), the number of frames in an animation (e.g. AVIF), and 1 otherwise.
```
|
I believe `buf` should be of type `OutputArray`. Or not?
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/loadsave.cpp
**Change Type:** modified
**Context:** PR #27013: Test for in-memory animation encoding and decoding
**Code Changes:**
```diff
@@ -811,6 +811,116 @@ bool imreadanimation(const String& filename, CV_OUT Animation& animation, int st
return imreadanimation_(filename, IMREAD_UNCHANGED, start, count, animation);
}
+static bool imdecodeanimation_(InputArray buf, int flags, int start, int count, Animation& animation)
+{
+ bool success = false;
+ if (start < 0) {
+ start = 0;
+ }
```
|
i think no need `CV_OUT` in .cpp file bool imdecodeanimation(InputArray buf, Animation& animation, int start, int count)
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/loadsave.cpp
**Change Type:** modified
**Context:** PR #27013: Test for in-memory animation encoding and decoding
**Code Changes:**
```diff
@@ -811,6 +811,116 @@ bool imreadanimation(const String& filename, CV_OUT Animation& animation, int st
return imreadanimation_(filename, IMREAD_UNCHANGED, start, count, animation);
}
+static bool imdecodeanimation_(InputArray buf, int flags, int start, int count, Animation& animation)
+{
+ bool success = false;
+ if (start < 0) {
+ start = 0;
+ }
```
|
i think no need `CV_OUT` in .cpp file static bool imencodeanimation_(const String& ext, const Animation& animation, std::vector<uchar>& buf, const std::vector<int>& params)
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/loadsave.cpp
**Change Type:** modified
**Context:** PR #27013: Test for in-memory animation encoding and decoding
**Code Changes:**
```diff
@@ -811,6 +811,116 @@ bool imreadanimation(const String& filename, CV_OUT Animation& animation, int st
return imreadanimation_(filename, IMREAD_UNCHANGED, start, count, animation);
}
+static bool imdecodeanimation_(InputArray buf, int flags, int start, int count, Animation& animation)
+{
+ bool success = false;
+ if (start < 0) {
+ start = 0;
+ }
```
|
bool imencodeanimation(const String& ext, const Animation& animation, std::vector<uchar>& buf, const std::vector<int>& params)
|
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/imgcodecs/include/opencv2/imgcodecs.hpp
**Change Type:** modified
**Context:** PR #27013: Test for in-memory animation encoding and decoding
**Review Line:** 436
**Code Changes:**
```diff
+specify additional options for the encoding process. Refer to `cv::ImwriteFlags`
+for details on possible parameters.
+
+@return Returns true if the animation was successfully encoded; returns false otherwise.
+*/
+CV_EXPORTS_W bool imencodeanimation(const String& ext, const Animation& animation, CV_OUT std::vector<uchar>& buf, const std::vector<int>& params = std::vector<int>());
+
/** @brief Returns the number of images inside the given file
The function imcount returns the number of pages in a multi-page image (e.g. TIFF), the number of frames in an animation (e.g. AVIF), and 1 otherwise.
```
|
All analogs use std::vector: - imdecode: https://docs.opencv.org/4.x/d4/da8/group__imgcodecs.html#ga4e9883ae1f619bcbe875b7038520ea78 - indecodemulti: https://docs.opencv.org/4.x/d4/da8/group__imgcodecs.html#ga913e55d27f30e7b56f40eddc09fccb76 Most probably, they call std::vector::resize() to fit encoded size. It's not available throw OutputArray interface.
|
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/grfmt_gif.cpp
**Change Type:** modified
**Context:** PR #27138: Fix heap buffer overflow and use after free in imgcodecs
**Code Changes:**
```diff
@@ -392,6 +392,8 @@ bool GifDecoder::lzwDecode() {
if (code < colorTableSize) {
imgCodeStream[idx++] = (uchar)code;
} else {
+ CV_LOG_WARNING(NULL, "Too long LZW length in GIF.");
+ CV_Assert(idx + lzwExtraTable[code].length <= width * height);
for (int i = 0; i < lzwExtraTable[code].length - 1; i++) {
imgCodeStream[idx++] = lzwExtraTable[code].prefix[i];
}
```
|
I would say that it should be just assert like: ``` CV_Assert(idx + lzwExtraTable[code].length <= width * height); ``` The caller side has `try/catch` to handle it. But it's could be caught by debugger. Some warning about broken gif is useful too.
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #27138: Fix heap buffer overflow and use after free in imgcodecs
**Code Changes:**
```diff
@@ -401,7 +401,7 @@ bool PngDecoder::readData( Mat& img )
Mat mat_cur = Mat::zeros(img.rows, img.cols, m_type);
uint32_t id = 0;
uint32_t j = 0;
- uint32_t imagesize = m_width * m_height * mat_cur.channels();
+ uint32_t imagesize = m_width * m_height * (uint32_t)mat_cur.elemSize();
m_is_IDAT_loaded = false;
if (m_frame_no == 0)
@@ -451,15 +451,26 @@ bool PngDecoder::readData( Mat& img )
```
|
i am not sure `mat_cur.convertTo(mat_cur, CV_8U, 1. / 255);` problematic but if extra Mat needed here please do same changes at line 523
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #27138: Fix heap buffer overflow and use after free in imgcodecs
**Code Changes:**
```diff
@@ -401,7 +401,7 @@ bool PngDecoder::readData( Mat& img )
Mat mat_cur = Mat::zeros(img.rows, img.cols, m_type);
uint32_t id = 0;
uint32_t j = 0;
- uint32_t imagesize = m_width * m_height * mat_cur.channels();
+ uint32_t imagesize = m_width * m_height * (uint32_t)mat_cur.elemSize();
m_is_IDAT_loaded = false;
if (m_frame_no == 0)
@@ -451,15 +451,26 @@ bool PngDecoder::readData( Mat& img )
```
|
The problem is that mat_cur is modified while frameCur is defined using it and it can be used in the memcpy right after. mat_cur cannot be modified. I added the optimization you propose.
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/grfmt_png.cpp
**Change Type:** modified
**Context:** PR #27138: Fix heap buffer overflow and use after free in imgcodecs
**Code Changes:**
```diff
@@ -401,7 +401,7 @@ bool PngDecoder::readData( Mat& img )
Mat mat_cur = Mat::zeros(img.rows, img.cols, m_type);
uint32_t id = 0;
uint32_t j = 0;
- uint32_t imagesize = m_width * m_height * mat_cur.channels();
+ uint32_t imagesize = m_width * m_height * (uint32_t)mat_cur.elemSize();
m_is_IDAT_loaded = false;
if (m_frame_no == 0)
@@ -451,15 +451,26 @@ bool PngDecoder::readData( Mat& img )
```
|
i see. wonderful!!
|
You are an expert OpenCV code reviewer specializing in performance optimization. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgproc/src/imgwarp.cpp
**Change Type:** modified
**Context:** PR #27108: When WARP_INVERSE_MAP is used, accelerate the calculation with multi-threading
**Code Changes:**
```diff
@@ -3737,41 +3737,46 @@ void cv::warpPolar(InputArray _src, OutputArray _dst, Size dsize,
else
Kmag = maxRadius / ssize.width;
- int x, y;
Mat bufx, bufy, bufp, bufa;
bufx = Mat(1, dsize.width, CV_32F);
bufy = Mat(1, dsize.width, CV_32F);
bufp = Mat(1, dsize.width, CV_32F);
```
|
I do not think that it's efficient parallel_for_. The thread function is too lightweight.
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/test/test_gif.cpp
**Change Type:** modified
**Context:** PR #26971: imgcodecs: gif: support animated gif without loop
**Code Changes:**
```diff
@@ -414,6 +414,110 @@ TEST(Imgcodecs_Gif, decode_disposal_method)
}
}
+// See https://github.com/opencv/opencv/issues/26970
+typedef testing::TestWithParam<int> Imgcodecs_Gif_loop_count;
+TEST_P(Imgcodecs_Gif_loop_count, imwriteanimation)
+{
+ const string gif_filename = cv::tempfile(".gif");
+
```
|
Netscape Application
|
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/imgcodecs/include/opencv2/imgcodecs.hpp
**Change Type:** modified
**Context:** PR #26971: imgcodecs: gif: support animated gif without loop
**Review Line:** 272
**Code Changes:**
```diff
+ */
CV_PROP_RW int loop_count;
//! Background color of the animation in BGRA format.
CV_PROP_RW Scalar bgcolor;
//! Duration for each frame in milliseconds.
+ /*! @note (GIF) Due to file format limitation
+ * - Durations must be multiples of 10 milliseconds. Any provided value will be rounded down to the nearest 10ms (e.g., 88ms → 80ms).
+ * - 0ms(or smaller than expected in user application) duration may cause undefined behavior, e.g. it is handled with default duration.
+ * - Over 65535 * 10 milliseconds duration is not supported.
+ */
CV_PROP_RW std::vector<int> durations;
```
|
>>Both 65535ms(about 1min) and 655350ms(about 11min) are a very long durations as animation frames. >>So this restriction is not expected to affect user experience. >>To make compatibility with other codecs, should I limit with CV_CheckLE(frameDelay, 65535, "Unsupported duration") >>? i think the PR as is good. up to you using in documentation `- Durations must be multiples of 10 milliseconds. Any provided value will be rounded down to the nearest 10ms (e.g., 88ms → 80ms).`
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/grfmt_gif.cpp
**Change Type:** modified
**Context:** PR #26971: imgcodecs: gif: support animated gif without loop
**Code Changes:**
```diff
@@ -47,8 +47,8 @@ bool GifDecoder::readHeader() {
return false;
}
- String signature(6, ' ');
- m_strm.getBytes((uchar*)signature.data(), 6);
+ std::string signature(6, ' ');
+ m_strm.getBytes((uchar*)signature.c_str(), 6);
CV_Assert(signature == R"(GIF87a)" || signature == R"(GIF89a)");
```
|
Please use C++: ``` std::string app_auth_code(len); m_strm.getBytes(const_cast<void*>(static_cast<const void*>(app_auth_code.c_str())), len); isFoundNetscape = (app_auth_code == "NETSCAPE2.0"); ```
|
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/imgcodecs/include/opencv2/imgcodecs.hpp
**Change Type:** modified
**Context:** PR #26971: imgcodecs: gif: support animated gif without loop
**Code Changes:**
```diff
@@ -118,8 +118,8 @@ enum ImwriteFlags {
IMWRITE_JPEGXL_EFFORT = 641,//!< For JPEG XL, encoder effort/speed level without affecting decoding speed; it is between 1 (fastest) and 10 (slowest). Default is 7.
IMWRITE_JPEGXL_DISTANCE = 642,//!< For JPEG XL, distance level for lossy compression: target max butteraugli distance, lower = higher quality, 0 = lossless; range: 0 .. 25. Default is 1.
IMWRITE_JPEGXL_DECODING_SPEED = 643,//!< For JPEG XL, decoding speed tier for the provided options; minimum is 0 (slowest to decode, best quality/density), and maximum is 4 (fastest to decode, at the cost of some quality/density). Default is 0.
- IMWRITE_GIF_LOOP = 1024,//!< For GIF, it can be a loop flag from 0 to 65535. Default is 0 - loop forever.
- IMWRITE_GIF_SPEED = 1025,//!< For GIF, it is between 1 (slowest) and 100 (fastest). Default is 96.
+ IMWRITE_GIF_LOOP = 1024, //!< Not functional since 4.12.0. Replaced by cv::Animation::loop_count.
+ IMWRITE_GIF_SPEED = 1025, //!< Not functional since 4.12.0. Replaced by cv::Animation::durations.
IMWRITE_GIF_QUALITY = 1026, //!< For GIF, it can be a quality from 1 to 8. Default is 2. See cv::ImwriteGifCompressionFlags.
IMWRITE_GIF_DITHER = 1027, //!< For GIF, it can be a quality from -1(most dither) to 3(no dither). Default is 0.
```
|
For more context: https://issues.chromium.org/issues/40459899 . WebP had the same problem where 1 loop coould not happen: https://groups.google.com/a/webmproject.org/g/webp-discuss/c/rJ2a0j1BNQI/m/XXqK918ZEQAJ
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/grfmt_gif.cpp
**Change Type:** modified
**Context:** PR #26971: imgcodecs: gif: support animated gif without loop
**Code Changes:**
```diff
@@ -47,8 +47,8 @@ bool GifDecoder::readHeader() {
return false;
}
- String signature(6, ' ');
- m_strm.getBytes((uchar*)signature.data(), 6);
+ std::string signature(6, ' ');
+ m_strm.getBytes((uchar*)signature.c_str(), 6);
CV_Assert(signature == R"(GIF87a)" || signature == R"(GIF89a)");
```
|
Shouldn't there be an interpretation if `!isFoundNetscape` too ?
|
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/nary_eltwise_layers.cpp
**Change Type:** modified
**Context:** PR #24768: Vulkan backend for NaryEltwiseLayer in DNN module
**Code Changes:**
```diff
@@ -7,6 +7,7 @@
#include "../op_cuda.hpp"
#include "../op_cann.hpp"
#include "../ie_ngraph.hpp"
+#include "../op_vkcom.hpp"
#include <opencv2/dnn/shape_utils.hpp>
@@ -34,8 +35,141 @@ static int _mod(int x, int y) {
}
```
|
Please use `makePtr` here and other places instead of new.
|
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:** modules/dnn/src/vkcom/shader/nary_eltwise_binary_forward.comp
**Change Type:** added
**Context:** PR #24768: Vulkan backend for NaryEltwiseLayer in DNN module
**Code Changes:**
```diff
@@ -0,0 +1,116 @@
+#version 450
+// #extension GL_EXT_debug_printf : enable
+#define ALL_THREAD 1024
+// #define ALL_THREAD 128 // Experimental batched operation
+#define STEP_SIZE 65536
+
+layout(binding = 0) readonly buffer Input1{
+ float matA[];
+};
```
|
Please remove dead code.
|
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:** modules/dnn/src/vkcom/shader/nary_eltwise_binary_forward.comp
**Change Type:** added
**Context:** PR #24768: Vulkan backend for NaryEltwiseLayer in DNN module
**Code Changes:**
```diff
@@ -0,0 +1,116 @@
+#version 450
+// #extension GL_EXT_debug_printf : enable
+#define ALL_THREAD 1024
+// #define ALL_THREAD 128 // Experimental batched operation
+#define STEP_SIZE 65536
+
+layout(binding = 0) readonly buffer Input1{
+ float matA[];
+};
```
|
Please remove dead code, or guard it with macro, if you want to use it later.
|
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/dnn/src/layers/nary_eltwise_layers.cpp
**Change Type:** modified
**Context:** PR #24768: Vulkan backend for NaryEltwiseLayer in DNN module
**Code Changes:**
```diff
@@ -7,6 +7,7 @@
#include "../op_cuda.hpp"
#include "../op_cann.hpp"
#include "../ie_ngraph.hpp"
+#include "../op_vkcom.hpp"
#include <opencv2/dnn/shape_utils.hpp>
@@ -34,8 +35,141 @@ static int _mod(int x, int y) {
}
```
|
> //TODO(VK) remember to add implemented operations Is this comment out-of-date?
|
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/dnn/src/layers/nary_eltwise_layers.cpp
**Change Type:** modified
**Context:** PR #24768: Vulkan backend for NaryEltwiseLayer in DNN module
**Code Changes:**
```diff
@@ -7,6 +7,7 @@
#include "../op_cuda.hpp"
#include "../op_cann.hpp"
#include "../ie_ngraph.hpp"
+#include "../op_vkcom.hpp"
#include <opencv2/dnn/shape_utils.hpp>
@@ -34,8 +35,141 @@ static int _mod(int x, int y) {
}
```
|
> // TODO(vk) what unclear meaning comment
|
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/nary_eltwise_layers.cpp
**Change Type:** modified
**Context:** PR #24768: Vulkan backend for NaryEltwiseLayer in DNN module
**Code Changes:**
```diff
@@ -7,6 +7,7 @@
#include "../op_cuda.hpp"
#include "../op_cann.hpp"
#include "../ie_ngraph.hpp"
+#include "../op_vkcom.hpp"
#include <opencv2/dnn/shape_utils.hpp>
@@ -34,8 +35,141 @@ static int _mod(int x, int y) {
}
```
|
Since they share the same code with CPU implementation, could you extract and make it a function to call to reduce duplicate code?
|
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/nary_eltwise_layers.cpp
**Change Type:** modified
**Context:** PR #24768: Vulkan backend for NaryEltwiseLayer in DNN module
**Code Changes:**
```diff
@@ -7,6 +7,7 @@
#include "../op_cuda.hpp"
#include "../op_cann.hpp"
#include "../ie_ngraph.hpp"
+#include "../op_vkcom.hpp"
#include <opencv2/dnn/shape_utils.hpp>
@@ -34,8 +35,141 @@ static int _mod(int x, int y) {
}
```
|
I've checked `convolution_layer.cpp`, `gemm_layer.cpp`, and other layers and found out that those existing implementations all use `new vkcom::OpNary`. Should we change all of them to `makePtr`?
|
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/nary_eltwise_layers.cpp
**Change Type:** modified
**Context:** PR #24768: Vulkan backend for NaryEltwiseLayer in DNN module
**Code Changes:**
```diff
@@ -7,6 +7,7 @@
#include "../op_cuda.hpp"
#include "../op_cann.hpp"
#include "../ie_ngraph.hpp"
+#include "../op_vkcom.hpp"
#include <opencv2/dnn/shape_utils.hpp>
@@ -34,8 +35,141 @@ static int _mod(int x, int y) {
}
```
|
Can this be a member function in helper class?
|
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/nary_eltwise_layers.cpp
**Change Type:** modified
**Context:** PR #24768: Vulkan backend for NaryEltwiseLayer in DNN module
**Code Changes:**
```diff
@@ -7,6 +7,7 @@
#include "../op_cuda.hpp"
#include "../op_cann.hpp"
#include "../ie_ngraph.hpp"
+#include "../op_vkcom.hpp"
#include <opencv2/dnn/shape_utils.hpp>
@@ -34,8 +35,141 @@ static int _mod(int x, int y) {
}
```
|
Are these variables `InputWrappers`, `inputShapes`, `outputWrapper`, `outputShape` and `vkBlobs` used anywhere?
|
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/nary_eltwise_layers.cpp
**Change Type:** modified
**Context:** PR #24768: Vulkan backend for NaryEltwiseLayer in DNN module
**Code Changes:**
```diff
@@ -7,6 +7,7 @@
#include "../op_cuda.hpp"
#include "../op_cann.hpp"
#include "../ie_ngraph.hpp"
+#include "../op_vkcom.hpp"
#include <opencv2/dnn/shape_utils.hpp>
@@ -34,8 +35,141 @@ static int _mod(int x, int y) {
}
```
|
Seems useless. These are remaining codes from a previous version in which `NaryEltwiseHelper` is not introduced.
|
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/nary_eltwise_layers.cpp
**Change Type:** modified
**Context:** PR #24768: Vulkan backend for NaryEltwiseLayer in DNN module
**Code Changes:**
```diff
@@ -7,6 +7,7 @@
#include "../op_cuda.hpp"
#include "../op_cann.hpp"
#include "../ie_ngraph.hpp"
+#include "../op_vkcom.hpp"
#include <opencv2/dnn/shape_utils.hpp>
@@ -34,8 +35,141 @@ static int _mod(int x, int y) {
}
```
|
Friendly reminder on this item.
|
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:** 3rdparty/hal_rvv/hal_rvv_1p0/cart_to_polar.hpp
**Change Type:** added
**Context:** PR #27000: [HAL RVV] reuse atan | impl cart_to_polar | add perf test
**Code Changes:**
```diff
@@ -0,0 +1,48 @@
+// 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) 2025, Institute of Software, Chinese Academy of Sciences.
+
+#ifndef OPENCV_HAL_RVV_CART_TO_POLAR_HPP_INCLUDED
+#define OPENCV_HAL_RVV_CART_TO_POLAR_HPP_INCLUDED
+
```
|
Use something like below https://github.com/opencv/opencv/blob/12d182bf9e2fa518aafad75dd5b77835c75674b4/3rdparty/hal_rvv/hal_rvv_1p0/merge.hpp#L4-L5
|
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:** 3rdparty/hal_rvv/hal_rvv_1p0/cart_to_polar.hpp
**Change Type:** added
**Context:** PR #27000: [HAL RVV] reuse atan | impl cart_to_polar | add perf test
**Code Changes:**
```diff
@@ -0,0 +1,48 @@
+// 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) 2025, Institute of Software, Chinese Academy of Sciences.
+
+#ifndef OPENCV_HAL_RVV_CART_TO_POLAR_HPP_INCLUDED
+#define OPENCV_HAL_RVV_CART_TO_POLAR_HPP_INCLUDED
+
```
|
If these are shared across different files, it is better to put them in a file like `common.hpp` or `common_utils.hpp`.
|
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:** 3rdparty/hal_rvv/hal_rvv_1p0/cart_to_polar.hpp
**Change Type:** added
**Context:** PR #27000: [HAL RVV] reuse atan | impl cart_to_polar | add perf test
**Code Changes:**
```diff
@@ -0,0 +1,48 @@
+// 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) 2025, Institute of Software, Chinese Academy of Sciences.
+
+#ifndef OPENCV_HAL_RVV_CART_TO_POLAR_HPP_INCLUDED
+#define OPENCV_HAL_RVV_CART_TO_POLAR_HPP_INCLUDED
+
```
|
I'm not sure whether it's better to put it in a common file or keep it separate. A separate file keeps each file smaller and makes the functionality clearer, so I prefer placing it in its own file. Moreover, if we use a common file, I think it would be difficult to determine whether a function should be placed in it.
|
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:** 3rdparty/hal_rvv/hal_rvv_1p0/cart_to_polar.hpp
**Change Type:** added
**Context:** PR #27000: [HAL RVV] reuse atan | impl cart_to_polar | add perf test
**Code Changes:**
```diff
@@ -0,0 +1,48 @@
+// 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) 2025, Institute of Software, Chinese Academy of Sciences.
+
+#ifndef OPENCV_HAL_RVV_CART_TO_POLAR_HPP_INCLUDED
+#define OPENCV_HAL_RVV_CART_TO_POLAR_HPP_INCLUDED
+
```
|
Leave it as-is for now.
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/test/test_animation.cpp
**Change Type:** modified
**Context:** PR #27087: Fixing imread() function 16 bit APNG reading problem
**Review Line:** 659
**Code Changes:**
```diff
+ EXPECT_EQ(65280, img.at<ushort>(0, 2));
+ EXPECT_EQ(65535, img.at<ushort>(0, 3));
+
+ img = imread(filename, IMREAD_GRAYSCALE);
+ ASSERT_FALSE(img.empty());
+ EXPECT_TRUE(img.type() == CV_8UC1);
+ EXPECT_EQ(76, img.at<uchar>(0, 0));
+
+ img = imread(filename, IMREAD_COLOR);
+ ASSERT_FALSE(img.empty());
+ EXPECT_TRUE(img.type() == CV_8UC3);
```
|
Is 033.png 16 bit or 8 bit? Asking for grayscale should keep the depth
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/test/test_animation.cpp
**Change Type:** modified
**Context:** PR #27087: Fixing imread() function 16 bit APNG reading problem
**Review Line:** 659
**Code Changes:**
```diff
+ EXPECT_EQ(65280, img.at<ushort>(0, 2));
+ EXPECT_EQ(65535, img.at<ushort>(0, 3));
+
+ img = imread(filename, IMREAD_GRAYSCALE);
+ ASSERT_FALSE(img.empty());
+ EXPECT_TRUE(img.type() == CV_8UC1);
+ EXPECT_EQ(76, img.at<uchar>(0, 0));
+
+ img = imread(filename, IMREAD_COLOR);
+ ASSERT_FALSE(img.empty());
+ EXPECT_TRUE(img.type() == CV_8UC3);
```
|
033.png is `CV_16UC4` IMREAD_GRAYSCALE converts it to `CV_8UC1` by default. let me check `IMREAD_GRAYSCALE | IMREAD_ANYDEPTH`
|
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/minmax.dispatch.cpp
**Change Type:** modified
**Context:** PR #26946: Fix HAL dispatch in cv::minMaxIdx
**Code Changes:**
```diff
@@ -314,18 +314,15 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
if (src.dims <= 2)
{
- if ((size_t)src.step == (size_t)mask.step)
+ if ((size_t)src.step == (size_t)mask.step || mask.empty())
{
CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols*cn, src.rows,
src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data);
}
```
|
`(mask.isContinuous() || mask.empty())`
|
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/core/src/minmax.dispatch.cpp
**Change Type:** modified
**Context:** PR #26946: Fix HAL dispatch in cv::minMaxIdx
**Code Changes:**
```diff
@@ -314,18 +314,15 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
if (src.dims <= 2)
{
- if ((size_t)src.step == (size_t)mask.step)
+ if ((size_t)src.step == (size_t)mask.step || mask.empty())
{
CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols*cn, src.rows,
src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data);
}
```
|
I would rewrite it as following: ``` if ((size_t)src.step == (size_t)mask.step || mask.empty()) { CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols*cn, src.rows, src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data); } CALL_HAL(minMaxIdxMaskStep, cv_hal_minMaxIdxMaskStep, src.data, src.step, src.cols*cn, src.rows, src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data, mask.step); ``` minMaxIdxMaskStep was introduced not so far ago. It allows to use old version without mask step everywhere it's possible. If the some HAL implements new API only, it has a chance too.
|
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/minmax.dispatch.cpp
**Change Type:** modified
**Context:** PR #26946: Fix HAL dispatch in cv::minMaxIdx
**Review Line:** 322
**Code Changes:**
```diff
- else
- {
- CALL_HAL(minMaxIdxMaskStep, cv_hal_minMaxIdxMaskStep, src.data, src.step, src.cols*cn, src.rows,
- src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data, mask.step);
- }
+ CALL_HAL(minMaxIdxMaskStep, cv_hal_minMaxIdxMaskStep, src.data, src.step, src.cols*cn, src.rows,
+ src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data, mask.step);
}
- else if (src.isContinuous() && mask.isContinuous())
+ else if (src.isContinuous() && (mask.isContinuous() || mask.empty()))
{
```
|
I'm wondering why are HAL integrations for 4.x and 5.x are so different? Theoretically they should look the same.
|
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/minmax.dispatch.cpp
**Change Type:** modified
**Context:** PR #26946: Fix HAL dispatch in cv::minMaxIdx
**Review Line:** 322
**Code Changes:**
```diff
- else
- {
- CALL_HAL(minMaxIdxMaskStep, cv_hal_minMaxIdxMaskStep, src.data, src.step, src.cols*cn, src.rows,
- src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data, mask.step);
- }
+ CALL_HAL(minMaxIdxMaskStep, cv_hal_minMaxIdxMaskStep, src.data, src.step, src.cols*cn, src.rows,
+ src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data, mask.step);
}
- else if (src.isContinuous() && mask.isContinuous())
+ else if (src.isContinuous() && (mask.isContinuous() || mask.empty()))
{
```
|
`Mat1D` and `Core_Array` tests are disabled in 4.x so all tests passed. This patch should also be applied to 4.x. These two failures are not specific to RISC-V or my implementation of HAL. Without this fix, existing HALs will also fail these two tests.
|
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/minmax.dispatch.cpp
**Change Type:** modified
**Context:** PR #26946: Fix HAL dispatch in cv::minMaxIdx
**Code Changes:**
```diff
@@ -314,18 +314,15 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
if (src.dims <= 2)
{
- if ((size_t)src.step == (size_t)mask.step)
+ if ((size_t)src.step == (size_t)mask.step || mask.empty())
{
CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols*cn, src.rows,
src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data);
}
```
|
Why do you need `ofs2idx` for the case `dims < 2`. For 1d array the second index will be just zero. Right?
|
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/minmax.dispatch.cpp
**Change Type:** modified
**Context:** PR #26946: Fix HAL dispatch in cv::minMaxIdx
**Code Changes:**
```diff
@@ -314,18 +314,15 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
if (src.dims <= 2)
{
- if ((size_t)src.step == (size_t)mask.step)
+ if ((size_t)src.step == (size_t)mask.step || mask.empty())
{
CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols*cn, src.rows,
src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data);
}
```
|
Just tried KleidiCV HAL for ARM and it handles 1d case correctly, but it does not support masks.
|
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/core/src/minmax.dispatch.cpp
**Change Type:** modified
**Context:** PR #26946: Fix HAL dispatch in cv::minMaxIdx
**Code Changes:**
```diff
@@ -314,18 +314,15 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
if (src.dims <= 2)
{
- if ((size_t)src.step == (size_t)mask.step)
+ if ((size_t)src.step == (size_t)mask.step || mask.empty())
{
CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols*cn, src.rows,
src.depth(), minVal, maxVal, minIdx, maxIdx, mask.data);
}
```
|
> Why do you need `ofs2idx` for the case `dims < 2`. For 1d array the second index will be just zero. Right? The HAL can not distinguish 1D `a[n]` between 2D `a[1][n]`. It will treat 1D array as `1xn` 2D array, and then the first index will be zero. HAL interface: ```cpp inline int hal_ni_minMaxIdx(const uchar* src_data, size_t src_step, int width, int height, int depth, double* minVal, double* maxVal, int* minIdx, int* maxIdx, uchar* mask) { return CV_HAL_ERROR_NOT_IMPLEMENTED; } ``` `a[n]` and `a[1][n]` both will pass `src_step=sizeof(T)*width, width=n, height=1`. Please let me know if there is a more elegant solution to this.
|
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/grfmt_gif.cpp
**Change Type:** modified
**Context:** PR #27047: Move the CV_Assert above the << operation to not trigger the fuzzer
**Code Changes:**
```diff
@@ -319,9 +319,9 @@ bool GifDecoder::lzwDecode() {
lzwMinCodeSize = m_strm.getByte();
const int lzwMaxSize = (1 << 12); // 4096 is the maximum size of the LZW table (12 bits)
int lzwCodeSize = lzwMinCodeSize + 1;
+ CV_Assert(lzwCodeSize > 2 && lzwCodeSize <= 12);
int clearCode = 1 << lzwMinCodeSize;
int exitCode = clearCode + 1;
- CV_Assert(lzwCodeSize > 2 && lzwCodeSize <= 12);
std::vector<lzwNodeD> lzwExtraTable(lzwMaxSize + 1);
int colorTableSize = clearCode;
```
|
`int lzwCodeSize = lzwMinCodeSize + 1;` Why the following `CV_Assert(lzwCodeSize > 2 && lzwCodeSize <= 12);` is not enough?
|
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/grfmt_gif.cpp
**Change Type:** modified
**Context:** PR #27047: Move the CV_Assert above the << operation to not trigger the fuzzer
**Code Changes:**
```diff
@@ -319,9 +319,9 @@ bool GifDecoder::lzwDecode() {
lzwMinCodeSize = m_strm.getByte();
const int lzwMaxSize = (1 << 12); // 4096 is the maximum size of the LZW table (12 bits)
int lzwCodeSize = lzwMinCodeSize + 1;
+ CV_Assert(lzwCodeSize > 2 && lzwCodeSize <= 12);
int clearCode = 1 << lzwMinCodeSize;
int exitCode = clearCode + 1;
- CV_Assert(lzwCodeSize > 2 && lzwCodeSize <= 12);
std::vector<lzwNodeD> lzwExtraTable(lzwMaxSize + 1);
int colorTableSize = clearCode;
```
|
I propose to use CV_Assert, if the value is not expected in correct gif.
|
You are an expert OpenCV code reviewer specializing in implementation quality. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/imgcodecs/src/grfmt_gif.cpp
**Change Type:** modified
**Context:** PR #27047: Move the CV_Assert above the << operation to not trigger the fuzzer
**Code Changes:**
```diff
@@ -319,9 +319,9 @@ bool GifDecoder::lzwDecode() {
lzwMinCodeSize = m_strm.getByte();
const int lzwMaxSize = (1 << 12); // 4096 is the maximum size of the LZW table (12 bits)
int lzwCodeSize = lzwMinCodeSize + 1;
+ CV_Assert(lzwCodeSize > 2 && lzwCodeSize <= 12);
int clearCode = 1 << lzwMinCodeSize;
int exitCode = clearCode + 1;
- CV_Assert(lzwCodeSize > 2 && lzwCodeSize <= 12);
std::vector<lzwNodeD> lzwExtraTable(lzwMaxSize + 1);
int colorTableSize = clearCode;
```
|
Ah indeed, thx, I missed that. I am moving it above the << operation which triggered the fuzzer
|
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/src/norm.simd.hpp
**Change Type:** modified
**Context:** PR #26991: core: improve norm of hal rvv
**Review Line:** 8
**Code Changes:**
```diff
-#if CV_RVV
-#include "norm.rvv1p0.hpp"
-#endif
-
namespace cv {
using NormFunc = int (*)(const uchar*, const uchar*, uchar*, int, int);
@@ -181,9 +177,6 @@ struct NormInf_SIMD<int, int> {
int operator() (const int* src, int n) const {
int j = 0;
int s = 0;
```
|
Where is replacement for these removed optimizations? (added by #26885)
|
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/src/norm.simd.hpp
**Change Type:** modified
**Context:** PR #26991: core: improve norm of hal rvv
**Review Line:** 8
**Code Changes:**
```diff
-#if CV_RVV
-#include "norm.rvv1p0.hpp"
-#endif
-
namespace cv {
using NormFunc = int (*)(const uchar*, const uchar*, uchar*, int, int);
@@ -181,9 +177,6 @@ struct NormInf_SIMD<int, int> {
int operator() (const int* src, int n) const {
int j = 0;
int s = 0;
```
|
All moved to hal rvv.
|
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_QT.cpp
**Change Type:** modified
**Context:** PR #27082: displayOverlay doesn't disappear after timeout
**Code Changes:**
```diff
@@ -2949,6 +2949,7 @@ void DefaultViewPort::stopDisplayInfo()
{
timerDisplay->stop();
drawInfo = false;
+ viewport()->update();
}
```
|
What if just add "update" to the end of `DefaultViewPort::stopDisplayInfo()`? The method is involed by existing timer. No need to create a new one.
|
You are an expert OpenCV code reviewer specializing in testing and validation. Review the provided code changes and provide specific, actionable feedback.
|
**File:** modules/highgui/src/window_QT.cpp
**Change Type:** modified
**Context:** PR #27082: displayOverlay doesn't disappear after timeout
**Code Changes:**
```diff
@@ -2949,6 +2949,7 @@ void DefaultViewPort::stopDisplayInfo()
{
timerDisplay->stop();
drawInfo = false;
+ viewport()->update();
}
```
|
Actually yeah, i just tested and i think it's working. Let me just check again.
|
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:** 3rdparty/hal_rvv/hal_rvv_1p0/polar_to_cart.hpp
**Change Type:** added
**Context:** PR #26999: [HAL RVV] unify and impl polar_to_cart | add perf test
**Code Changes:**
```diff
@@ -0,0 +1,53 @@
+// 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) 2025, Institute of Software, Chinese Academy of Sciences.
+
+#ifndef OPENCV_HAL_RVV_POLAR_TO_CART_HPP_INCLUDED
+#define OPENCV_HAL_RVV_POLAR_TO_CART_HPP_INCLUDED
+
```
|
nit: Use something like below https://github.com/opencv/opencv/blob/12d182bf9e2fa518aafad75dd5b77835c75674b4/3rdparty/hal_rvv/hal_rvv_1p0/merge.hpp#L4-L5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.