nareshmlx/opencv-pr huggingface dataset:
**File:** modules/photo/src/contrast_preserve.cpp
**Change Type:** modified
**Context:** PR #10997: Optimize decolor in photo - ### This pullrequest changes - Replaced `vector.push_back` into `vector.resize()` and `vector[i] = foo;` to imp...

**Code Changes:**
```diff
@@ -82,7 +82,7 @@ void cv::decolor(InputArray _src, OutputArray _dst, OutputArray _color_boost)
 
     vector <double> Cg;
     vector < vector <double> > polyGrad;
-    vector < vector < int > > comb;
+    vector <Vec3i> comb;
 
     vector <double> alf;
 
@@ -103,20 +103,20 @@ void cv::decolor(InputArray _src, OutputArray _dst, OutputArray _color_boost)
```

Review comment:
"Mat img;" is enough (without initialization, like changes below).
**File:** modules/photo/src/contrast_preserve.hpp
**Change Type:** modified
**Context:** PR #10997: Optimize decolor in photo - ### This pullrequest changes - Replaced `vector.push_back` into `vector.resize()` and `vector[i] = foo;` to imp...

**Code Changes:**
```diff
@@ -58,19 +58,19 @@ class Decolor
     public:
         float sigma;
         void init();
-        vector<double> product(vector < vector<int> > &comb, vector <double> &initRGB);
+        vector<double> product(vector <Vec3i> &comb, const double initRGB[3]);
         double energyCalcu(vector <double> &Cg, vector < vector <double> > &polyGrad, vector <double> &wei);
         void singleChannelGradx(const Mat &img, Mat& dest);
         void singleChannelGrady(const Mat &img, Mat& dest);
         void gradvector(const Mat &img, vector <double> &grad);
```

Review comment:
Use this form: ``` t1[i] = (Rg[i] > level) ? 1.0 : 0.0; ```
**File:** modules/photo/src/contrast_preserve.hpp
**Change Type:** modified
**Context:** PR #10997: Optimize decolor in photo - ### This pullrequest changes - Replaced `vector.push_back` into `vector.resize()` and `vector[i] = foo;` to imp...

**Code Changes:**
```diff
@@ -58,19 +58,19 @@ class Decolor
     public:
         float sigma;
         void init();
-        vector<double> product(vector < vector<int> > &comb, vector <double> &initRGB);
+        vector<double> product(vector <Vec3i> &comb, const double initRGB[3]);
         double energyCalcu(vector <double> &Cg, vector < vector <double> > &polyGrad, vector <double> &wei);
         void singleChannelGradx(const Mat &img, Mat& dest);
         void singleChannelGrady(const Mat &img, Mat& dest);
         void gradvector(const Mat &img, vector <double> &grad);
```

Review comment:
"Dead code" in comments should be removed.
**File:** modules/photo/src/contrast_preserve.hpp
**Change Type:** modified
**Context:** PR #10997: Optimize decolor in photo - ### This pullrequest changes - Replaced `vector.push_back` into `vector.resize()` and `vector[i] = foo;` to imp...

**Code Changes:**
```diff
@@ -58,19 +58,19 @@ class Decolor
     public:
         float sigma;
         void init();
-        vector<double> product(vector < vector<int> > &comb, vector <double> &initRGB);
+        vector<double> product(vector <Vec3i> &comb, const double initRGB[3]);
         double energyCalcu(vector <double> &Cg, vector < vector <double> > &polyGrad, vector <double> &wei);
         void singleChannelGradx(const Mat &img, Mat& dest);
         void singleChannelGrady(const Mat &img, Mat& dest);
         void gradvector(const Mat &img, vector <double> &grad);
```

Review comment:
It is shorter: ``` float v = Gray.at<float>(i, j); minval = std::min(minval, v); maxval = std::max(maxval, v); ``` Or better to use well optimized [`cv::minmaxLoc()`](https://docs.opencv.org/master/d2/de8/group__core__array.html#gab473bf2eb6d14ff97e89b355dac20707) instead of these loops.
**File:** modules/photo/src/contrast_preserve.hpp
**Change Type:** modified
**Context:** PR #10997: Optimize decolor in photo - ### This pullrequest changes - Replaced `vector.push_back` into `vector.resize()` and `vector[i] = foo;` to imp...

**Code Changes:**
```diff
@@ -58,19 +58,19 @@ class Decolor
     public:
         float sigma;
         void init();
-        vector<double> product(vector < vector<int> > &comb, vector <double> &initRGB);
+        vector<double> product(vector <Vec3i> &comb, const double initRGB[3]);
         double energyCalcu(vector <double> &Cg, vector < vector <double> > &polyGrad, vector <double> &wei);
         void singleChannelGradx(const Mat &img, Mat& dest);
         void singleChannelGrady(const Mat &img, Mat& dest);
         void gradvector(const Mat &img, vector <double> &grad);
```

Review comment:
👍 I will try this change in the next refactoring patch.
**File:** modules/dnn/include/opencv2/dnn/all_layers.hpp
**Change Type:** modified
**Context:** PR #9517: Layers for MobileNet from TensorFlow -  ### This pullrequest changes resolves https://github.com/opencv/opencv/issues/9462 (waiting for feed...
**Review Line:** 362

**Code Changes:**
```diff
@@ -359,6 +359,12 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
         static Ptr<ReLULayer> create(const LayerParams &params);
     };
 
+    class CV_EXPORTS ReLU6Layer : public ActivationLayer
+    {
+    public:
+        static Ptr<ReLU6Layer> create(const LayerParams &params);
+    };
+
```

Review comment:
can we make the layer slightly more universal? `result(x, y, c) = min(max(src(x, y, c), a), b)` with customizable `a` and `b`?
**File:** modules/dnn/src/layers/elementwise_layers.cpp
**Change Type:** modified
**Context:** PR #9517: Layers for MobileNet from TensorFlow -  ### This pullrequest changes resolves https://github.com/opencv/opencv/issues/9462 (waiting for feed...

**Code Changes:**
```diff
@@ -248,6 +248,62 @@ struct ReLUFunctor
     int64 getFLOPSPerElement() const { return 1; }
 };
 
+struct ReLU6Functor
+{
+    typedef ReLU6Layer Layer;
+    float minValue, maxValue;
+
+    ReLU6Functor(float minValue_ = 0.0f, float maxValue_ = 6.0f)
```

Review comment:
use more efficient `v_min` and `v_max` instead of `v_select`
**File:** modules/dnn/src/tensorflow/tf_importer.cpp
**Change Type:** modified
**Context:** PR #9517: Layers for MobileNet from TensorFlow -  ### This pullrequest changes resolves https://github.com/opencv/opencv/issues/9462 (waiting for feed...
**Review Line:** 675

**Code Changes:**
```diff
+                kshape[0] = inCh * chMultiplier;
+                kshape[1] = 1;
+            }
             layerParams.set("kernel_h", kshape[2]);
             layerParams.set("kernel_w", kshape[3]);
             layerParams.set("num_output", kshape[0]);
@@ -689,6 +737,10 @@ void TFImporter::populateNet(Net dstNet)
             layerParams.blobs.resize(1);
 
             StrIntVector next_layers = getNextLayers(net, name, "BiasAdd");
+            if (next_layers.empty())
```

Review comment:
set some `min_value=0` and `max_value=6` here
**File:** modules/dnn/include/opencv2/dnn/all_layers.hpp
**Change Type:** modified
**Context:** PR #9517: Layers for MobileNet from TensorFlow -  ### This pullrequest changes resolves https://github.com/opencv/opencv/issues/9462 (waiting for feed...
**Review Line:** 362

**Code Changes:**
```diff
@@ -359,6 +359,12 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
         static Ptr<ReLULayer> create(const LayerParams &params);
     };
 
+    class CV_EXPORTS ReLU6Layer : public ActivationLayer
+    {
+    public:
+        static Ptr<ReLU6Layer> create(const LayerParams &params);
+    };
+
```

Review comment:
Generalized. Name of layer is the same.
**File:** modules/dnn/src/layers/elementwise_layers.cpp
**Change Type:** modified
**Context:** PR #9517: Layers for MobileNet from TensorFlow -  ### This pullrequest changes resolves https://github.com/opencv/opencv/issues/9462 (waiting for feed...

**Code Changes:**
```diff
@@ -248,6 +248,62 @@ struct ReLUFunctor
     int64 getFLOPSPerElement() const { return 1; }
 };
 
+struct ReLU6Functor
+{
+    typedef ReLU6Layer Layer;
+    float minValue, maxValue;
+
+    ReLU6Functor(float minValue_ = 0.0f, float maxValue_ = 6.0f)
```

Review comment:
clamp(input, minValue, maxValue) ?
**File:** modules/ml/test/test_mltests2.cpp
**Change Type:** modified
**Context:** PR #10141: Add ReLU and LeakyReLU activation function in ml module - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/409 Add ReLU an...
**Review Line:** 247

**Code Changes:**
```diff
+        x->predict(testSamples, rx);
+        y->predict(testSamples, ry);
+        absdiff(rx, ry, dst);
+        double minVal, maxVal;
+        minMaxLoc(dst, &minVal, &maxVal);
+        ASSERT_TRUE(maxVal<FLT_EPSILON) << "Predict are not equal for " << dataname + activationName[i] + ".yml and " << activationName[i];
+#endif
+    }
+}
+
 // 6. dtree
```

Review comment:
BTW, absdiff()+minMaxLoc() => `[cvtest::]norm(rx, ry, NORM_INF)` ([documentation](https://docs.opencv.org/3.3.0/d2/de8/group__core__array.html#gad12cefbcb5291cf958a85b4b67b6149f)) `cvtest` namespace is recommended for test checks.
**File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #10575: Added getFontScaleFromHeight() - Adding a function to compute font scale for a desired font height in pixels
**Review Line:** 4734

**Code Changes:**
```diff
@@ -4730,6 +4730,20 @@ CV_EXPORTS_W Size getTextSize(const String& text, int fontFace,
                             double fontScale, int thickness,
                             CV_OUT int* baseLine);
 
+
+/** @brief Calculates the font-specific size to use to achieve a given height in pixels.
+
+@param fontFace Font to use, see cv::HersheyFonts.
+@param pixelHeight Pixel height to compute the fontScale for
+@param thickness Thickness of lines used to render the text.See putText for details.
+@return The fontSize to use for cv::putText
```

Review comment:
Could you please add usage sample as we have for ```getTextSize```
**File:** modules/imgproc/src/drawing.cpp
**Change Type:** modified
**Context:** PR #10575: Added getFontScaleFromHeight() - Adding a function to compute font scale for a desired font height in pixels
**Review Line:** 2369

**Code Changes:**
```diff
     return size;
 }
 
+double getFontScaleFromHeight(const int fontFace, const int pixelHeight, const int thickness)
+{
+    // By https://stackoverflow.com/a/27898487/1531708
+    const int* ascii = getFontData(fontFace);
+
+    int base_line = (ascii[0] & 15);
+    int cap_line = (ascii[0] >> 4) & 15;
+
```

Review comment:
I don't think this link is helpfull here since stakoverflow is pointing to opencv: > I have found out that the cv::getTextSize in opencv looks as follows
**File:** modules/imgproc/src/drawing.cpp
**Change Type:** modified
**Context:** PR #10575: Added getFontScaleFromHeight() - Adding a function to compute font scale for a desired font height in pixels
**Review Line:** 2375

**Code Changes:**
```diff
+    const int* ascii = getFontData(fontFace);
+
+    int base_line = (ascii[0] & 15);
+    int cap_line = (ascii[0] >> 4) & 15;
+
+    return static_cast<double>(pixelHeight - static_cast<double>((thickness + 1)) / 2.0) / static_cast<double>(cap_line + base_line);
+}
+
 }
 
 
```

Review comment:
a bit shorter: ``` return static_cast<double>(pixelHeight - 0.5 * (thickness + 1)) / static_cast<double>(cap_line + base_line); ```
**File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #10575: Added getFontScaleFromHeight() - Adding a function to compute font scale for a desired font height in pixels
**Review Line:** 4743

**Code Changes:**
```diff
+@param thickness Thickness of lines used to render the text.See putText for details.
+@return The fontSize to use for cv::putText
+
+@see cv::putText
+*/
+CV_EXPORTS_W double getFontScaleFromHeight(const int fontFace,
+                                           const int pixelHeight,
+                                           const int thickness = 1);
+
 /** @brief Line iterator
 
```

Review comment:
no need to pass values by const
**File:** modules/imgproc/src/drawing.cpp
**Change Type:** modified
**Context:** PR #10575: Added getFontScaleFromHeight() - Adding a function to compute font scale for a desired font height in pixels
**Review Line:** 2369

**Code Changes:**
```diff
     return size;
 }
 
+double getFontScaleFromHeight(const int fontFace, const int pixelHeight, const int thickness)
+{
+    // By https://stackoverflow.com/a/27898487/1531708
+    const int* ascii = getFontData(fontFace);
+
+    int base_line = (ascii[0] & 15);
+    int cap_line = (ascii[0] >> 4) & 15;
+
```

Review comment:
The link points to the answer containing the code for ``getFontScaleFromHeight()``
**File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #10575: Added getFontScaleFromHeight() - Adding a function to compute font scale for a desired font height in pixels
**Review Line:** 4743

**Code Changes:**
```diff
+@param thickness Thickness of lines used to render the text.See putText for details.
+@return The fontSize to use for cv::putText
+
+@see cv::putText
+*/
+CV_EXPORTS_W double getFontScaleFromHeight(const int fontFace,
+                                           const int pixelHeight,
+                                           const int thickness = 1);
+
 /** @brief Line iterator
 
```

Review comment:
Personally, I like to keep things const whenever possible. Can change it if you advise, though
**File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #10575: Added getFontScaleFromHeight() - Adding a function to compute font scale for a desired font height in pixels
**Review Line:** 4734

**Code Changes:**
```diff
@@ -4730,6 +4730,20 @@ CV_EXPORTS_W Size getTextSize(const String& text, int fontFace,
                             double fontScale, int thickness,
                             CV_OUT int* baseLine);
 
+
+/** @brief Calculates the font-specific size to use to achieve a given height in pixels.
+
+@param fontFace Font to use, see cv::HersheyFonts.
+@param pixelHeight Pixel height to compute the fontScale for
+@param thickness Thickness of lines used to render the text.See putText for details.
+@return The fontSize to use for cv::putText
```

Review comment:
Yes, I think we need this in separate pull request.
**File:** modules/imgproc/src/drawing.cpp
**Change Type:** modified
**Context:** PR #10575: Added getFontScaleFromHeight() - Adding a function to compute font scale for a desired font height in pixels
**Review Line:** 2369

**Code Changes:**
```diff
     return size;
 }
 
+double getFontScaleFromHeight(const int fontFace, const int pixelHeight, const int thickness)
+{
+    // By https://stackoverflow.com/a/27898487/1531708
+    const int* ascii = getFontData(fontFace);
+
+    int base_line = (ascii[0] & 15);
+    int cap_line = (ascii[0] >> 4) & 15;
+
```

Review comment:
Yep, but this code is pretty similar to getTextSize code. So there is no need to external links.
**File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #10575: Added getFontScaleFromHeight() - Adding a function to compute font scale for a desired font height in pixels
**Review Line:** 4743

**Code Changes:**
```diff
+@param thickness Thickness of lines used to render the text.See putText for details.
+@return The fontSize to use for cv::putText
+
+@see cv::putText
+*/
+CV_EXPORTS_W double getFontScaleFromHeight(const int fontFace,
+                                           const int pixelHeight,
+                                           const int thickness = 1);
+
 /** @brief Line iterator
 
```

Review comment:
It is minor issue, but it leads to inconsistency between public functions, e.g. comparing to getTextSize, where only String parameter is passed by const ref.
**File:** modules/dnn/src/layers/prior_box_layer.cpp
**Change Type:** modified
**Context:** PR #10874: Use only absolute prior boxes explicit sizes. Remove scales attributes. -  ### This pullrequest changes **Merge with extra**: https://githu...

**Code Changes:**
```diff
@@ -179,44 +179,62 @@ class PriorBoxLayerImpl : public PriorBoxLayer
     }
 
     PriorBoxLayerImpl(const LayerParams &params)
-        : _boxWidth(0), _boxHeight(0)
     {
         setParamsFrom(params);
         _minSize = getParameter<float>(params, "min_size", 0, false, 0);
         _flip = getParameter<bool>(params, "flip", 0, false, true);
         _clip = getParameter<bool>(params, "clip", 0, false, true);
```

Review comment:
I believe we should avoid this approach. It is better to use compile-time definitions and `#ifdef` blocks in OpenCL code instead of dummy parameters. It will produce more effective code without such hacks.
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #10406: core: replace raw intrinsics with universal intrinsics in copy.cpp - ### This pullrequest changes - replace raw intrinsics with universal i...
**Review Line:** 149

**Code Changes:**
```diff
+
+                v_uint8x16 v_nmask1, v_nmask2;
+                v_uint8x16 v_nmask = v_load(mask + x) == v_zero;
+                v_zip(v_nmask, v_nmask, v_nmask1, v_nmask2);
+
+                #if CV_SSE4_2
+                v_dst1 = v_uint16x8(_mm_blendv_epi8(v_src1.val, v_dst1.val, v_nmask1.val));
+                v_dst2 = v_uint16x8(_mm_blendv_epi8(v_src2.val, v_dst2.val, v_nmask2.val));
+                #else
+                v_dst1 = v_select(v_reinterpret_as_u16(v_nmask1), v_dst1, v_src1);
+                v_dst2 = v_select(v_reinterpret_as_u16(v_nmask2), v_dst2, v_src2);
```

Review comment:
unfortunately, currently we are not testing this branch; can we remove it for now?
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #10406: core: replace raw intrinsics with universal intrinsics in copy.cpp - ### This pullrequest changes - replace raw intrinsics with universal i...
**Review Line:** 107

**Code Changes:**
```diff
+            {
+                v_uint8x16 v_src   = v_load(src  + x),
+                           v_dst   = v_load(dst  + x),
+                           v_nmask = v_load(mask + x) == v_zero;
+
+                #if CV_SSE4_2
+                v_dst = v_uint8x16(_mm_blendv_epi8(v_src.val, v_dst.val, v_nmask.val));
+                #else
+                v_dst = v_select(v_nmask, v_dst, v_src);
+                #endif
+                v_store(dst + x, v_dst);
```

Review comment:
unfortunately, we are not testing this branch currently; can we remove it for now?
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #10406: core: replace raw intrinsics with universal intrinsics in copy.cpp - ### This pullrequest changes - replace raw intrinsics with universal i...
**Review Line:** 149

**Code Changes:**
```diff
+
+                v_uint8x16 v_nmask1, v_nmask2;
+                v_uint8x16 v_nmask = v_load(mask + x) == v_zero;
+                v_zip(v_nmask, v_nmask, v_nmask1, v_nmask2);
+
+                #if CV_SSE4_2
+                v_dst1 = v_uint16x8(_mm_blendv_epi8(v_src1.val, v_dst1.val, v_nmask1.val));
+                v_dst2 = v_uint16x8(_mm_blendv_epi8(v_src2.val, v_dst2.val, v_nmask2.val));
+                #else
+                v_dst1 = v_select(v_reinterpret_as_u16(v_nmask1), v_dst1, v_src1);
+                v_dst2 = v_select(v_reinterpret_as_u16(v_nmask2), v_dst2, v_src2);
```

Review comment:
I did some perf tests. if it isn't enough, sure we can remove it for now.
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #10406: core: replace raw intrinsics with universal intrinsics in copy.cpp - ### This pullrequest changes - replace raw intrinsics with universal i...
**Review Line:** 149

**Code Changes:**
```diff
+
+                v_uint8x16 v_nmask1, v_nmask2;
+                v_uint8x16 v_nmask = v_load(mask + x) == v_zero;
+                v_zip(v_nmask, v_nmask, v_nmask1, v_nmask2);
+
+                #if CV_SSE4_2
+                v_dst1 = v_uint16x8(_mm_blendv_epi8(v_src1.val, v_dst1.val, v_nmask1.val));
+                v_dst2 = v_uint16x8(_mm_blendv_epi8(v_src2.val, v_dst2.val, v_nmask2.val));
+                #else
+                v_dst1 = v_select(v_reinterpret_as_u16(v_nmask1), v_dst1, v_src1);
+                v_dst2 = v_select(v_reinterpret_as_u16(v_nmask2), v_dst2, v_src2);
```

Review comment:
I believe it is better to move this branch into `v_select()` implementation directly. See [this example](https://github.com/opencv/opencv/blob/3.4.0/modules/core/include/opencv2/core/hal/intrin_sse.hpp#L1179-L1191).
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #10406: core: replace raw intrinsics with universal intrinsics in copy.cpp - ### This pullrequest changes - replace raw intrinsics with universal i...
**Review Line:** 149

**Code Changes:**
```diff
+
+                v_uint8x16 v_nmask1, v_nmask2;
+                v_uint8x16 v_nmask = v_load(mask + x) == v_zero;
+                v_zip(v_nmask, v_nmask, v_nmask1, v_nmask2);
+
+                #if CV_SSE4_2
+                v_dst1 = v_uint16x8(_mm_blendv_epi8(v_src1.val, v_dst1.val, v_nmask1.val));
+                v_dst2 = v_uint16x8(_mm_blendv_epi8(v_src2.val, v_dst2.val, v_nmask2.val));
+                #else
+                v_dst1 = v_select(v_reinterpret_as_u16(v_nmask1), v_dst1, v_src1);
+                v_dst2 = v_select(v_reinterpret_as_u16(v_nmask2), v_dst2, v_src2);
```

Review comment:
I don't think so. v_select() is a bitwise select but mask in _mm_blendv_epi8() must be packed as 8-bit of 0x00 or 0xFF. Should I add new universal intrinsic? or just remove this branch? Also I made a mistake here _mm_blendv_epi8() is part of SSE4.1 not SSE4.2.
**File:** modules/core/src/copy.cpp
**Change Type:** modified
**Context:** PR #10406: core: replace raw intrinsics with universal intrinsics in copy.cpp - ### This pullrequest changes - replace raw intrinsics with universal i...
**Review Line:** 149

**Code Changes:**
```diff
+
+                v_uint8x16 v_nmask1, v_nmask2;
+                v_uint8x16 v_nmask = v_load(mask + x) == v_zero;
+                v_zip(v_nmask, v_nmask, v_nmask1, v_nmask2);
+
+                #if CV_SSE4_2
+                v_dst1 = v_uint16x8(_mm_blendv_epi8(v_src1.val, v_dst1.val, v_nmask1.val));
+                v_dst2 = v_uint16x8(_mm_blendv_epi8(v_src2.val, v_dst2.val, v_nmask2.val));
+                #else
+                v_dst1 = v_select(v_reinterpret_as_u16(v_nmask1), v_dst1, v_src1);
+                v_dst2 = v_select(v_reinterpret_as_u16(v_nmask2), v_dst2, v_src2);
```

Review comment:
for now using `_mm_blendv_epi8()` is fine. Later on we might construct the proper universal intrinsic with the same efficiency
**File:** modules/dnn/src/layers/pooling_layer.cpp
**Change Type:** modified
**Context:** PR #10724: fix faster_rcnn sample crashed at PoolingInvoker on Windows7(x64). - fix faster_rcnn sample crashed at PoolingInvoker operator() of pooling...

**Code Changes:**
```diff
@@ -287,7 +287,7 @@ class PoolingLayerImpl : public PoolingLayer
             bool compMaxIdx = computeMaxIdx;
 
 #if CV_SIMD128
-            const int* ofsptr = &ofsbuf[0];
+            const int* ofsptr = ofsbuf.empty() ? 0 : (const int*)&ofsbuf[0];
             v_float32x4 idx00(0.f, (float)stride_w, (float)(stride_w*2), (float)(stride_w*3));
             v_float32x4 ones = v_setall_f32(1.f);
             v_float32x4 idx_delta = v_setall_f32((float)(inp_width - kernel_w));
```

Review comment:
`const int* ofsptr = ofsbuf.empty() ? 0 : &ofsbuf[0];` is the better solution
**File:** modules/dnn/src/layers/pooling_layer.cpp
**Change Type:** modified
**Context:** PR #10724: fix faster_rcnn sample crashed at PoolingInvoker on Windows7(x64). - fix faster_rcnn sample crashed at PoolingInvoker operator() of pooling...

**Code Changes:**
```diff
@@ -287,7 +287,7 @@ class PoolingLayerImpl : public PoolingLayer
             bool compMaxIdx = computeMaxIdx;
 
 #if CV_SIMD128
-            const int* ofsptr = &ofsbuf[0];
+            const int* ofsptr = ofsbuf.empty() ? 0 : (const int*)&ofsbuf[0];
             v_float32x4 idx00(0.f, (float)stride_w, (float)(stride_w*2), (float)(stride_w*3));
             v_float32x4 ones = v_setall_f32(1.f);
             v_float32x4 idx_delta = v_setall_f32((float)(inp_width - kernel_w));
```

Review comment:
let's keep `std::vector<>`