nareshmlx/opencv-pr huggingface dataset:
**File:** samples/dnn/classification.cpp
**Change Type:** modified
**Context:** PR #20406: [GSoC] OpenCV.js: Accelerate OpenCV.js DNN via WebNN - ### Overview Proposal: OpenCV.js: Accelerate OpenCV.js DNN via WebNN Mentor: Ningxin...

**Code Changes:**
```diff
@@ -1,5 +1,6 @@
 #include <fstream>
 #include <sstream>
+#include <iostream>
 
 #include <opencv2/dnn.hpp>
 #include <opencv2/imgproc.hpp>
@@ -17,14 +18,16 @@ std::string keys =
     "{ std              | 0.0 0.0 0.0 | Preprocess input image by dividing on a standard deviation.}"
     "{ crop             | false | Preprocess input image by center cropping.}"
```

Review comment:
`sum = (float)cv::sum(softmaxProb)[0];` to resolve MSVC warning
**File:** modules/dnn/misc/python/test/test_dnn.py
**Change Type:** modified
**Context:** PR #20480: Add Python's test for LSTM layer
**Review Line:** 331

**Code Changes:**
```diff
+        net = cv.dnn.readNet(model)
+        input = np.load(input_file)
+        # we have to expand the shape of input tensor because Python bindings cut 3D tensors to 2D
+        # it should be fixed in future. see : https://github.com/opencv/opencv/issues/19091
+        # please remove `expand_dims` after that
+        input = np.expand_dims(input, axis=3)
+        gold_output = np.load(output_file)
+        net.setInput(input)
+
+        for backend, target in self.dnnBackendsAndTargets:
+            printParams(backend, target)
```

Review comment:
I'm OK to merge PR with changed name of the test: `test_lstm` -> `test_input_3d` It makes sense to add here a comment with link on https://github.com/opencv/opencv/issues/19091 issue Requirement of `expand_dims` statement would be removed in the future.
**File:** modules/dnn/src/layers/layers_common.simd.hpp
**Change Type:** modified
**Context:** PR #20287: Optimization of DNN using native RISC-V vector intrinsics.
**Review Line:** 833

**Code Changes:**
```diff
+            vs7 = vfmacc_vv_f32m2(vs7, vle32_v_f32m2(wptr + wstep*7, vl), v, vl);
+        }
+
+        // Calculate the sum of each vector
+        vfloat32m1_t zero = vfmv_v_f_f32m1(0, vl);
+        vfloat32m1_t temp0 = vfredsum_vs_f32m2_f32m1(temp0, vs0, zero, vl);
+        vfloat32m1_t temp1 = vfredsum_vs_f32m2_f32m1(temp1, vs1, zero, vl);
+        vfloat32m1_t temp2 = vfredsum_vs_f32m2_f32m1(temp2, vs2, zero, vl);
+        vfloat32m1_t temp3 = vfredsum_vs_f32m2_f32m1(temp3, vs3, zero, vl);
+        vfloat32m1_t temp4 = vfredsum_vs_f32m2_f32m1(temp4, vs4, zero, vl);
+        vfloat32m1_t temp5 = vfredsum_vs_f32m2_f32m1(temp5, vs5, zero, vl);
```

Review comment:
does this code compile? the initialization expression for temp0 references itself. As a more general comment, probably the reduction can be optimized further. Is there a way to compute the reduced sum into a vector register and use one store operation instead of 8?
**File:** modules/dnn/src/layers/layers_common.simd.hpp
**Change Type:** modified
**Context:** PR #20287: Optimization of DNN using native RISC-V vector intrinsics.

**Code Changes:**
```diff
@@ -737,5 +737,554 @@ void fastGEMM( const float* aptr, size_t astep, const float* bptr,
 
 #endif // CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY
 
+#if !defined(CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY) && CV_RVV
+
+void fastGEMM( const float* aptr, size_t astep, const float* bptr,
+               size_t bstep, float* cptr, size_t cstep,
+               int ma, int na, int nb )
+{
```

Review comment:
No need to run scalar code. You can use shorter vector for the tail.
**File:** modules/dnn/src/layers/layers_common.simd.hpp
**Change Type:** modified
**Context:** PR #20287: Optimization of DNN using native RISC-V vector intrinsics.

**Code Changes:**
```diff
@@ -737,5 +737,554 @@ void fastGEMM( const float* aptr, size_t astep, const float* bptr,
 
 #endif // CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY
 
+#if !defined(CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY) && CV_RVV
+
+void fastGEMM( const float* aptr, size_t astep, const float* bptr,
+               size_t bstep, float* cptr, size_t cstep,
+               int ma, int na, int nb )
+{
```

Review comment:
The same for the tail.
**File:** modules/dnn/src/layers/layers_common.simd.hpp
**Change Type:** modified
**Context:** PR #20287: Optimization of DNN using native RISC-V vector intrinsics.

**Code Changes:**
```diff
@@ -737,5 +737,554 @@ void fastGEMM( const float* aptr, size_t astep, const float* bptr,
 
 #endif // CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY
 
+#if !defined(CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY) && CV_RVV
+
+void fastGEMM( const float* aptr, size_t astep, const float* bptr,
+               size_t bstep, float* cptr, size_t cstep,
+               int ma, int na, int nb )
+{
```

Review comment:
With RVV 0.10 it's not needed any more. You just need to to pass vector size as intrinsic parameter.
**File:** modules/dnn/src/layers/layers_common.simd.hpp
**Change Type:** modified
**Context:** PR #20287: Optimization of DNN using native RISC-V vector intrinsics.

**Code Changes:**
```diff
@@ -737,5 +737,554 @@ void fastGEMM( const float* aptr, size_t astep, const float* bptr,
 
 #endif // CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY
 
+#if !defined(CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY) && CV_RVV
+
+void fastGEMM( const float* aptr, size_t astep, const float* bptr,
+               size_t bstep, float* cptr, size_t cstep,
+               int ma, int na, int nb )
+{
```

Review comment:
No need to initialize the vector.
**File:** modules/dnn/src/layers/layers_common.simd.hpp
**Change Type:** modified
**Context:** PR #20287: Optimization of DNN using native RISC-V vector intrinsics.

**Code Changes:**
```diff
@@ -737,5 +737,554 @@ void fastGEMM( const float* aptr, size_t astep, const float* bptr,
 
 #endif // CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY
 
+#if !defined(CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY) && CV_RVV
+
+void fastGEMM( const float* aptr, size_t astep, const float* bptr,
+               size_t bstep, float* cptr, size_t cstep,
+               int ma, int na, int nb )
+{
```

Review comment:
Switch at every loop iteration is bad idea. I propose to do the following: - Reduce loop iterations by one, if vecsize is not dividable by 8. - Run remaining iterations with step1 using RVV. Loop unrolling by 8 is helps to perform part of computation then.
**File:** modules/dnn/src/layers/layers_common.simd.hpp
**Change Type:** modified
**Context:** PR #20287: Optimization of DNN using native RISC-V vector intrinsics.

**Code Changes:**
```diff
@@ -737,5 +737,554 @@ void fastGEMM( const float* aptr, size_t astep, const float* bptr,
 
 #endif // CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY
 
+#if !defined(CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY) && CV_RVV
+
+void fastGEMM( const float* aptr, size_t astep, const float* bptr,
+               size_t bstep, float* cptr, size_t cstep,
+               int ma, int na, int nb )
+{
```

Review comment:
I agree. And there are two tail part in fastGEMM: "vecsize" and "nvecs". I have rewritten the code by loop unrolling and taking minimum to prevent out-of-bounds memory access.
**File:** modules/dnn/src/layers/layers_common.simd.hpp
**Change Type:** modified
**Context:** PR #20287: Optimization of DNN using native RISC-V vector intrinsics.
**Review Line:** 976

**Code Changes:**
```diff
+        for( ; j < blockSize; j += FASCONV_BASE_VECSZ )
+        {
+            bool tail = false;
+            if (j + FASCONV_BASE_VECSZ > blockSize)
+            {
+                if (j == 0) {
+                    vl = blockSize;
+                }
+                else {
+                    j = blockSize - FASCONV_BASE_VECSZ;
+                    tail = true;
```

Review comment:
Why do you need this branch? It case if `blockSize` is too small, tail should be called without loop iteration.
**File:** modules/dnn/src/layers/layers_common.simd.hpp
**Change Type:** modified
**Context:** PR #20287: Optimization of DNN using native RISC-V vector intrinsics.
**Review Line:** 976

**Code Changes:**
```diff
+        for( ; j < blockSize; j += FASCONV_BASE_VECSZ )
+        {
+            bool tail = false;
+            if (j + FASCONV_BASE_VECSZ > blockSize)
+            {
+                if (j == 0) {
+                    vl = blockSize;
+                }
+                else {
+                    j = blockSize - FASCONV_BASE_VECSZ;
+                    tail = true;
```

Review comment:
I would like to explain why there is a branch about `j==0`. When `j + 4 > blockSize`, it usually means we meet a tail then we use a tail mask and let `j = blockSize - 4` (compute the last 4 elements and store with mask). Example: - Assume blockSize=5 and output is 5*1, ignore the output channel - The mask will be `[0, 0, 0, 1]` - The first loop iteration will compute the first 4 elements in the output matrix, then the output should be `[√, √, √, √, TBD]`. Now, j = 4. - The second also the last loop iteration will compute the last element with the help of the mask. Actually, we compute the last 4 elements but only store the last one because of the mask. In detail, at the beginning of this iteration, j=4 and we find that `j + 4 > blockSize`, so we let `j = blockSize - 4`, now, j=1 then we compute the last 4 elements and only store the last one. However, there is another situation here when the blockSize is smaller than 4. In this case, we should not use mask but use `vl`. I will explain with an example. Example: - Assume `blockSize=1 `and output is 1*1, also ignore the output channel. - The mask will be also `[0, 0, 0, 1],` which can NOT use. - Instead, we let vl=1 and load-compute-store directly with the help of `vl`.
**File:** modules/core/src/system.cpp
**Change Type:** modified
**Context:** PR #20900: fix: correctly check neon flags for QNX platform

**Code Changes:**
```diff
@@ -129,7 +129,7 @@ void* allocSingletonNewBuffer(size_t size) { return malloc(size); }
 #if defined __ANDROID__ || defined __unix__ || defined __FreeBSD__ || defined __OpenBSD__ || defined __HAIKU__
 #  include <unistd.h>
 #  include <fcntl.h>
-#if defined __QNXNTO__
+#if defined __QNX__
 #  include <sys/elf.h>
 #else
 #  include <elf.h>
@@ -545,7 +545,7 @@ struct HWFeatures
```

Review comment:
Why not more generic `__QNX__`? `__QNXNTO__` is specific to QNX Neutrino and the check will be broken with the next platform release.
**File:** modules/dnn/src/layers/layers_common.simd.hpp
**Change Type:** modified
**Context:** PR #20521: Make the implementation of optimization in DNN adjustable to different vector sizes with RVV intrinsics.

**Code Changes:**
```diff
@@ -744,58 +744,66 @@ void fastGEMM( const float* aptr, size_t astep, const float* bptr,
                int ma, int na, int nb )
 {
     int n = 0;
-    size_t vl = 8;
-    size_t mvl0 = 8;
-    size_t mvl1 = 8;
-    for( ; n < nb; n += 16 )
+    int vl = vsetvlmax_e32m4();
+    int mvl = vl;
```

Review comment:
Please use cv::AutoBuffer here: https://docs.opencv.org/master/d8/dd0/classcv_1_1AutoBuffer.html
**File:** modules/dnn/src/layers/layers_common.simd.hpp
**Change Type:** modified
**Context:** PR #20521: Make the implementation of optimization in DNN adjustable to different vector sizes with RVV intrinsics.

**Code Changes:**
```diff
@@ -744,58 +744,66 @@ void fastGEMM( const float* aptr, size_t astep, const float* bptr,
                int ma, int na, int nb )
 {
     int n = 0;
-    size_t vl = 8;
-    size_t mvl0 = 8;
-    size_t mvl1 = 8;
-    for( ; n < nb; n += 16 )
+    int vl = vsetvlmax_e32m4();
+    int mvl = vl;
```

Review comment:
Fixed via 9508aa9
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
please remove extra line
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
replace all enums in header file outside classes, (e.c. `QRCodeCorrectionLevel` need to replace before class `QRCodeEncoder`)
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
please use standard OpenCV's architecture API and use current names: ```suggestion bool generate(cv::String input, cv::OutputArray output, int version, int correction_level = cv::CORRECT_LEVEL_L, int mode = cv::QR_MODE_AUTO, int structure_number = 1, Size output_size = (23, 23)); ``` `int m` - calculated parameter `int eci ` - use only UTF-8
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
There is no need to keep these variables in this class because they use only in class `QREncode`.
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
Don't change old API
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
please remove variables, reasons described above.
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
`version` parameter should also have default option (in this case we calculate the smallest possible version depending on the length of the input string)
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
They are also used in class QRDecode
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
please don't resolve conversation when the question isn't resolved. please remove these variables because they are not used in `decodeQRCode` and in class `QRCodeDetector`
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
please follow the recommended prototype: `bool generate(cv::String input, cv::OutputArray output, int version = 0, int correction_level = cv::CORRECT_LEVEL_L, int mode = cv::QR_MODE_AUTO, Size output_size = (23, 23), int structure_number = 1);` because of architecture solution `cv::OutputArray` can get both `cv::Mat` and `std::vector<cv::Mat>` (read [here](https://docs.opencv.org/3.4/d2/d9e/classcv_1_1__OutputArray.html)) `int m` - calculated parameter `int eci` - use only UTF-8 `version` - if 0, we calculate the smallest possible version depending on the length of the input string
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
`mask_type` need to calculate automatically
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
`straight_qrcode` has default parameter `noArray` which means that this parameter could be not necessary
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** added
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -0,0 +1,1265 @@
+// 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) 2021, Intel Corporation, all rights reserved.
+
+#include "precomp.hpp"
+#include "qrcode_encoder_table.inl.hpp"
+namespace cv
```

Review comment:
These variables are not used
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** added
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -0,0 +1,1265 @@
+// 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) 2021, Intel Corporation, all rights reserved.
+
+#include "precomp.hpp"
+#include "qrcode_encoder_table.inl.hpp"
+namespace cv
```

Review comment:
```suggestion for (i = 0; i < str_len - 1; i += 2) ```
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
Parameters should be split on 2 parts: - properties of algorithm - should go into constructor/`create()` methods - sample processing properties (output_size) This is useful to unify algorithms and provide one interface.
**File:** modules/objdetect/include/opencv2/objdetect.hpp
**Change Type:** modified
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -670,6 +670,69 @@ struct CV_EXPORTS_W HOGDescriptor
     void groupRectangles(std::vector<cv::Rect>& rectList, std::vector<double>& weights, int groupThreshold, double eps) const;
 };
 
+class CV_EXPORTS_W QRCodeEncoder {
+protected:
+    QRCodeEncoder();  // use ::create()
+public:
+    virtual ~QRCodeEncoder();
+
```

Review comment:
generate => encode remove unnecessary double spaces.
**File:** modules/objdetect/src/qrcode_encoder.cpp
**Change Type:** added
**Context:** PR #17889: QR code (encoding process) - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/807 [ISO standard](https://github.com/yansik...

**Code Changes:**
```diff
@@ -0,0 +1,1265 @@
+// 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) 2021, Intel Corporation, all rights reserved.
+
+#include "precomp.hpp"
+#include "qrcode_encoder_table.inl.hpp"
+namespace cv
```

Review comment:
Why do we need calib3d?