nareshmlx/opencv-pr huggingface dataset:
**File:** samples/cpp/tutorial_code/ImgProc/HitMiss/HitMiss.cpp
**Change Type:** renamed
**Context:** PR #9424: GSoC - Update Imgproc tutorials

**Code Changes:**
```diff
@@ -23,15 +23,22 @@ int main(){
     Mat output_image;
     morphologyEx(input_image, output_image, MORPH_HITMISS, kernel);
 
-    const int rate = 10;
+    const int rate = 50;
     kernel = (kernel + 1) * 127;
     kernel.convertTo(kernel, CV_8U);
+
     resize(kernel, kernel, Size(), rate, rate, INTER_NEAREST);
```

Review comment:
Why a change in indentation ?
**File:** doc/tutorials/imgproc/hitOrMiss/hitOrMiss.markdown
**Change Type:** modified
**Context:** PR #9424: GSoC - Update Imgproc tutorials

**Code Changes:**
```diff
@@ -1,22 +1,23 @@
 Hit-or-Miss {#tutorial_hitOrMiss}
 =================================
 
+@prev_tutorial{tutorial_opening_closing_hats}
+@next_tutorial{tutorial_morph_lines_detection}
+
 Goal
 ----
 
```

Review comment:
Please use "raw" URLs for files you embed to not overload the main server: https://raw.githubusercontent.com/opencv/opencv/master/samples/cpp/tutorial_code/ImgProc/HitMiss.cpp
**File:** doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/gausian_median_blur_bilateral_filter.markdown
**Change Type:** modified
**Context:** PR #9424: GSoC - Update Imgproc tutorials

**Code Changes:**
```diff
@@ -1,16 +1,18 @@
 Smoothing Images {#tutorial_gausian_median_blur_bilateral_filter}
 ================
 
+@next_tutorial{tutorial_erosion_dilatation}
+
 Goal
 ----
 
 In this tutorial you will learn how to apply diverse linear filters to smooth images using OpenCV
```

Review comment:
HTML tags in markdown files ?
**File:** doc/tutorials/imgproc/gausian_median_blur_bilateral_filter/gausian_median_blur_bilateral_filter.markdown
**Change Type:** modified
**Context:** PR #9424: GSoC - Update Imgproc tutorials

**Code Changes:**
```diff
@@ -1,16 +1,18 @@
 Smoothing Images {#tutorial_gausian_median_blur_bilateral_filter}
 ================
 
+@next_tutorial{tutorial_erosion_dilatation}
+
 Goal
 ----
 
 In this tutorial you will learn how to apply diverse linear filters to smooth images using OpenCV
```

Review comment:
yes, in doxygen it's allowed. See [here](https://www.stack.nl/~dimitri/doxygen/manual/htmlcmds.html)
**File:** doc/tutorials/imgproc/imgtrans/sobel_derivatives/sobel_derivatives.markdown
**Change Type:** modified
**Context:** PR #9424: GSoC - Update Imgproc tutorials
**Review Line:** 90

**Code Changes:**
```diff
 @note
     When the size of the kernel is `3`, the Sobel kernel shown above may produce noticeable
     inaccuracies (after all, Sobel is only an approximation of the derivative). OpenCV addresses
-    this inaccuracy for kernels of size 3 by using the @ref cv::Scharr function. This is as fast
+    this inaccuracy for kernels of size 3 by using the **Scharr()** function. This is as fast
     but more accurate than the standar Sobel function. It implements the following kernels:
     \f[G_{x} = \begin{bmatrix}
     -3 & 0 & +3  \\
@@ -95,9 +98,9 @@ Assuming that the image to be operated is \f$I\f$:
     +3 & +10 & +3
     \end{bmatrix}\f]
```

Review comment:
standar -> standart
**File:** modules/core/src/matrix.cpp
**Change Type:** modified
**Context:** PR #9776: Fix memory leak in the matrix copying constructor -  ### This pullrequest changes  As reported in the #9732 issue exception thrown inside th...

**Code Changes:**
```diff
@@ -279,21 +279,31 @@ Mat::Mat(const Mat& m, const Range& _rowRange, const Range& _colRange) : size(&r
     }
 
     *this = m;
-    if( _rowRange != Range::all() && _rowRange != Range(0,rows) )
+    try
     {
-        CV_Assert( 0 <= _rowRange.start && _rowRange.start <= _rowRange.end && _rowRange.end <= m.rows );
-        rows = _rowRange.size();
-        data += step*_rowRange.start;
```

Review comment:
Please keep indentation 4 spaces.
**File:** modules/calib3d/include/opencv2/calib3d.hpp
**Change Type:** modified
**Context:** PR #9596: calib3d: export parameters of CALIB_CB_CLUSTERING

**Code Changes:**
```diff
@@ -783,6 +783,14 @@ struct CV_EXPORTS_W_SIMPLE CirclesGridFinderParameters
     GridType gridType;
 };
 
+struct CV_EXPORTS_W_SIMPLE CirclesGridFinderParameters2 : public CirclesGridFinderParameters
+{
+    CV_WRAP CirclesGridFinderParameters2();
+
+    CV_PROP_RW float squareSize; //!< Distance between two adjacent points. Used by CALIB_CB_CLUSTERING.
+    CV_PROP_RW float maxRectifiedDistance; //!< Max deviation from predicion. Used by CALIB_CB_CLUSTERING.
```

Review comment:
increases size of `CirclesGridFinderParameters`
**File:** modules/core/include/opencv2/core/ocl.hpp
**Change Type:** modified
**Context:** PR #9604: OCL: support kernel profiling
**Review Line:** 339

**Code Changes:**
```diff
     static Queue& getDefault();
 
+    /// @brief Returns OpenCL command queue with enable profiling mode support
+    const Queue& getProfilingQueue() const;
+
+    struct Impl; friend struct Impl;
+    inline Impl* getImpl() const { return p; }
 protected:
-    struct Impl;
     Impl* p;
 };
```

Review comment:
is this part really necessary? looks like we break encapsulation, but usually we find a way to keep it
**File:** modules/core/include/opencv2/core/ocl.hpp
**Change Type:** modified
**Context:** PR #9604: OCL: support kernel profiling
**Review Line:** 339

**Code Changes:**
```diff
     static Queue& getDefault();
 
+    /// @brief Returns OpenCL command queue with enable profiling mode support
+    const Queue& getProfilingQueue() const;
+
+    struct Impl; friend struct Impl;
+    inline Impl* getImpl() const { return p; }
 protected:
-    struct Impl;
     Impl* p;
 };
```

Review comment:
This is still inaccessible via public API. Alternate way is to extend public API with new "private" methods that I want to avoid via this construction.
**File:** modules/dnn/src/tensorflow/tf_importer.cpp
**Change Type:** modified
**Context:** PR #9576: Import and convert FP16 weights from TensorFlow -  ### This pullrequest changes Experimental import of float16 weights from TensorFlow model...

**Code Changes:**
```diff
@@ -63,17 +63,59 @@ void blobShapeFromTensor(const tensorflow::TensorProto &tensor, MatShape& shape)
     {
         const tensorflow::TensorShapeProto &_shape = tensor.tensor_shape();
         int i, n = _shape.dim_size();
-        shape.resize(n);
+        if (n)
+        {
+            shape.resize(n);
 
-        for (i = 0; i < n; i++)
```

Review comment:
Why not using [ConvertFp16](https://github.com/opencv/opencv/blob/2ac57a2b1fc0b49ddd07f3e3633461fcab5fc3f0/modules/core/src/convert.cpp#L5092) which already converts from/to FP16 ?
**File:** modules/dnn/src/tensorflow/tf_importer.cpp
**Change Type:** modified
**Context:** PR #9576: Import and convert FP16 weights from TensorFlow -  ### This pullrequest changes Experimental import of float16 weights from TensorFlow model...

**Code Changes:**
```diff
@@ -63,17 +63,59 @@ void blobShapeFromTensor(const tensorflow::TensorProto &tensor, MatShape& shape)
     {
         const tensorflow::TensorShapeProto &_shape = tensor.tensor_shape();
         int i, n = _shape.dim_size();
-        shape.resize(n);
+        if (n)
+        {
+            shape.resize(n);
 
-        for (i = 0; i < n; i++)
```

Review comment:
Be careful with pseudo-inplace processing. A lot of functions don't support this well, also there is almost no tests for such functionality.
**File:** doc/tutorials/introduction/windows_install/windows_install.markdown
**Change Type:** modified
**Context:** PR #9514: Another way to build opencv - Add another method to build opencv on windows using git-bash and cmake.

**Code Changes:**
```diff
@@ -24,6 +24,80 @@ Installation by Using the Pre-built Libraries {#tutorial_windows_install_prebuil
 
 -#  To finalize the installation go to the @ref tutorial_windows_install_path section.
 
+Installation by Using git-bash (version>=2.14.1) and cmake (version >=3.9.1){#tutorial_windows_gitbash_build}
+===============================================================
+
+-#  You must download [cmake (version >=3.9.1)](https://cmake.org) and install it. You must add cmake to PATH variable during installation
+
+-#  You must install [git-bash (version>=2.14.1)](https://git-for-windows.github.io/). Don't add git to PATH variable during installation
```

Review comment:
`version>=2.14.1` here and above
**File:** doc/tutorials/introduction/windows_install/windows_install.markdown
**Change Type:** modified
**Context:** PR #9514: Another way to build opencv - Add another method to build opencv on windows using git-bash and cmake.

**Code Changes:**
```diff
@@ -24,6 +24,80 @@ Installation by Using the Pre-built Libraries {#tutorial_windows_install_prebuil
 
 -#  To finalize the installation go to the @ref tutorial_windows_install_path section.
 
+Installation by Using git-bash (version>=2.14.1) and cmake (version >=3.9.1){#tutorial_windows_gitbash_build}
+===============================================================
+
+-#  You must download [cmake (version >=3.9.1)](https://cmake.org) and install it. You must add cmake to PATH variable during installation
+
+-#  You must install [git-bash (version>=2.14.1)](https://git-for-windows.github.io/). Don't add git to PATH variable during installation
```

Review comment:
optCMAKE => CMAKE_OPTIONS ?
**File:** doc/tutorials/introduction/windows_install/windows_install.markdown
**Change Type:** modified
**Context:** PR #9514: Another way to build opencv - Add another method to build opencv on windows using git-bash and cmake.

**Code Changes:**
```diff
@@ -24,6 +24,80 @@ Installation by Using the Pre-built Libraries {#tutorial_windows_install_prebuil
 
 -#  To finalize the installation go to the @ref tutorial_windows_install_path section.
 
+Installation by Using git-bash (version>=2.14.1) and cmake (version >=3.9.1){#tutorial_windows_gitbash_build}
+===============================================================
+
+-#  You must download [cmake (version >=3.9.1)](https://cmake.org) and install it. You must add cmake to PATH variable during installation
+
+-#  You must install [git-bash (version>=2.14.1)](https://git-for-windows.github.io/). Don't add git to PATH variable during installation
```

Review comment:
without `cd ..` above you can use `.` (dot) here: ``` cmake --build . --config debug ```
**File:** doc/tutorials/introduction/windows_install/windows_install.markdown
**Change Type:** modified
**Context:** PR #9514: Another way to build opencv - Add another method to build opencv on windows using git-bash and cmake.

**Code Changes:**
```diff
@@ -24,6 +24,80 @@ Installation by Using the Pre-built Libraries {#tutorial_windows_install_prebuil
 
 -#  To finalize the installation go to the @ref tutorial_windows_install_path section.
 
+Installation by Using git-bash (version>=2.14.1) and cmake (version >=3.9.1){#tutorial_windows_gitbash_build}
+===============================================================
+
+-#  You must download [cmake (version >=3.9.1)](https://cmake.org) and install it. You must add cmake to PATH variable during installation
+
+-#  You must install [git-bash (version>=2.14.1)](https://git-for-windows.github.io/). Don't add git to PATH variable during installation
```

Review comment:
> --target install Consider to use `-DINSTALL_CREATE_DISTRIB=ON` CMake option to prevent touching of global files (like Python module from Python subfolder)
**File:** doc/tutorials/introduction/windows_install/windows_install.markdown
**Change Type:** modified
**Context:** PR #9514: Another way to build opencv - Add another method to build opencv on windows using git-bash and cmake.

**Code Changes:**
```diff
@@ -24,6 +24,80 @@ Installation by Using the Pre-built Libraries {#tutorial_windows_install_prebuil
 
 -#  To finalize the installation go to the @ref tutorial_windows_install_path section.
 
+Installation by Using git-bash (version>=2.14.1) and cmake (version >=3.9.1){#tutorial_windows_gitbash_build}
+===============================================================
+
+-#  You must download [cmake (version >=3.9.1)](https://cmake.org) and install it. You must add cmake to PATH variable during installation
+
+-#  You must install [git-bash (version>=2.14.1)](https://git-for-windows.github.io/). Don't add git to PATH variable during installation
```

Review comment:
`git pull --rebase` here and above
**File:** doc/tutorials/introduction/windows_install/windows_install.markdown
**Change Type:** modified
**Context:** PR #9514: Another way to build opencv - Add another method to build opencv on windows using git-bash and cmake.

**Code Changes:**
```diff
@@ -24,6 +24,80 @@ Installation by Using the Pre-built Libraries {#tutorial_windows_install_prebuil
 
 -#  To finalize the installation go to the @ref tutorial_windows_install_path section.
 
+Installation by Using git-bash (version>=2.14.1) and cmake (version >=3.9.1){#tutorial_windows_gitbash_build}
+===============================================================
+
+-#  You must download [cmake (version >=3.9.1)](https://cmake.org) and install it. You must add cmake to PATH variable during installation
+
+-#  You must install [git-bash (version>=2.14.1)](https://git-for-windows.github.io/). Don't add git to PATH variable during installation
```

Review comment:
Add script header, something like: ``` #!/bin/bash -e ``` To stop script execution on errors.
**File:** doc/tutorials/introduction/windows_install/windows_install.markdown
**Change Type:** modified
**Context:** PR #9514: Another way to build opencv - Add another method to build opencv on windows using git-bash and cmake.

**Code Changes:**
```diff
@@ -24,6 +24,80 @@ Installation by Using the Pre-built Libraries {#tutorial_windows_install_prebuil
 
 -#  To finalize the installation go to the @ref tutorial_windows_install_path section.
 
+Installation by Using git-bash (version>=2.14.1) and cmake (version >=3.9.1){#tutorial_windows_gitbash_build}
+===============================================================
+
+-#  You must download [cmake (version >=3.9.1)](https://cmake.org) and install it. You must add cmake to PATH variable during installation
+
+-#  You must install [git-bash (version>=2.14.1)](https://git-for-windows.github.io/). Don't add git to PATH variable during installation
```

Review comment:
`cd ../..` should be here to be consistent. Or use pushd/popd snippet: ```.diff -cd Build/$RepoSource +pushd Build/$RepoSource ... cmake commands ... -cd .. +popd ```
**File:** modules/imgproc/src/color.cpp
**Change Type:** modified
**Context:** PR #9470: Bit-exact version of Luv2RGB_b - ### This pullrequest changes 1. Luv2RGB_b is now calculated in integers which provides bit-exactness across...
**Review Line:** 6050

**Code Changes:**
```diff
+            {
+                softfloat v = softfloat(vv)*vRange/f255 + vLow;
+                softfloat vp = oneof4/(v + L*vn);
+                if(vp >  oneof4) vp =  oneof4;
+                if(vp < -oneof4) vp = -oneof4;
+                int ivp = cvRound(vp*softfloat(BASE*1024));
+                LvToVp_b[LL*256+vv] = ivp;
+                int vpl = ivp*LL;
+                LvToVpl_b[LL*256+vv] = (12*13*100*(BASE/1024))*(long long)vpl;
+            }
+        }
```

Review comment:
is there cvRound() overload for softfloat?
**File:** modules/imgproc/src/color.cpp
**Change Type:** modified
**Context:** PR #9470: Bit-exact version of Luv2RGB_b - ### This pullrequest changes 1. Luv2RGB_b is now calculated in integers which provides bit-exactness across...

**Code Changes:**
```diff
@@ -5881,9 +5881,13 @@ static int abToXZ_b[LAB_BASE*9/4];
 // Luv constants
 static const bool enableRGB2LuvInterpolation = true;
 static const bool enablePackedRGB2Luv = true;
+static const bool enablePackedLuv2RGB = true;
 static int16_t RGB2LuvLUT_s16[LAB_LUT_DIM*LAB_LUT_DIM*LAB_LUT_DIM*3*8];
 static const softfloat uLow(-134), uHigh(220), uRange(uHigh-uLow);
 static const softfloat vLow(-140), vHigh(122), vRange(vHigh-vLow);
+static int LuToUp_b[256*256];
+static int LvToVp_b[256*256];
```

Review comment:
probably we should replace NEON and SSE intrinsics with universal intrinsics
**File:** modules/imgproc/src/color.cpp
**Change Type:** modified
**Context:** PR #9470: Bit-exact version of Luv2RGB_b - ### This pullrequest changes 1. Luv2RGB_b is now calculated in integers which provides bit-exactness across...
**Review Line:** 6050

**Code Changes:**
```diff
+            {
+                softfloat v = softfloat(vv)*vRange/f255 + vLow;
+                softfloat vp = oneof4/(v + L*vn);
+                if(vp >  oneof4) vp =  oneof4;
+                if(vp < -oneof4) vp = -oneof4;
+                int ivp = cvRound(vp*softfloat(BASE*1024));
+                LvToVp_b[LL*256+vv] = ivp;
+                int vpl = ivp*LL;
+                LvToVpl_b[LL*256+vv] = (12*13*100*(BASE/1024))*(long long)vpl;
+            }
+        }
```

Review comment:
Sure, see [softfloat.cpp](https://github.com/opencv/opencv/blob/e70b75b51a40f2716b65d3b70e0ee56966267f4d/modules/core/include/opencv2/core/softfloat.hpp#L389)
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #9305: Make dnn networks creation by Importer is deprecated -  ### This pullrequest changes `CV_DEPRECATED` added for `createTorchImporter`, `creat...

**Code Changes:**
```diff
@@ -598,23 +598,27 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
         Ptr<Impl> impl;
     };
 
-    /** @brief Small interface class for loading trained serialized models of different dnn-frameworks. */
+    /**
+     * @deprecated Deprecated as external interface. Will be for internal needs only.
+     * @brief Small interface class for loading trained serialized models of different dnn-frameworks. */
     class CV_EXPORTS_W Importer : public Algorithm
     {
```

Review comment:
I think, destructors, which are called implicitly most of the time, should not be declared as deprecated
**File:** modules/dnn/include/opencv2/dnn/dnn.hpp
**Change Type:** modified
**Context:** PR #9591: Import and export FP16 Caffe models -  ### This pullrequest changes * Function that converts weights of Caffe models to FP16 ([NVidia Caffe]...

**Code Changes:**
```diff
@@ -701,6 +701,19 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
     CV_EXPORTS_W Mat blobFromImages(const std::vector<Mat>& images, double scalefactor=1.0,
                                     Size size = Size(), const Scalar& mean = Scalar(), bool swapRB=true);
 
+    /** @brief Convert all weights of Caffe network to half precision floating point.
+     * @param src Path to origin model from Caffe framework contains single
+     *            precision floating point weights (usually has `.caffemodel` extension).
+     * @param dst Path to destination model with updated weights.
+     *
+     * @note Shrinked model has no origin float32 weights so it can't be used
```

Review comment:
shrinkCaffeModel would be a better name that resembles `.caffemodel` extension.
**File:** modules/dnn/src/caffe/caffe.proto
**Change Type:** modified
**Context:** PR #9591: Import and export FP16 Caffe models -  ### This pullrequest changes * Function that converts weights of Caffe models to FP16 ([NVidia Caffe]...

**Code Changes:**
```diff
@@ -50,6 +50,16 @@ syntax = "proto2";
 
 package caffe;
 
+// NVidia's Caffe feature is used to store fp16 weights, https://github.com/NVIDIA/caffe:
+// Math and storage types
+enum Type {
+  DOUBLE = 0;
+  FLOAT = 1;
+  FLOAT16 = 2;
```

Review comment:
it would be nice to put something like that into official Caffe tree, or maybe find a branch where it's already done
**File:** doc/tutorials/dnn/dnn_halide/dnn_halide.markdown
**Change Type:** modified
**Context:** PR #9313: Performance test for Caffe efficiency measurements -  ### This pullrequest changes * Added performance test for Caffe * Remove out-date perf...
**Review Line:** 16

**Code Changes:**
```diff
@@ -8,20 +8,7 @@ according to specific device and evaluate it with a quite good efficiency.
 
 An official website of the Halide project: http://halide-lang.org/.
 
-## Efficiency comparison
-Measured on Intel&reg; Core&trade; i7-6700K CPU @ 4.00GHz x 8.
-
-Single image forward pass (in milliseconds):
-
-|     Architecture | MKL backend | Halide backend | Speed Up ratio |
-|-----------------:|------------:|---------------:|---------------:|
-|          AlexNet |       16.55 |          22.38 |          x0.73 |
-|        ResNet-50 |       63.69 |          73.91 |          x0.86 |
-|  SqueezeNet v1.1 |       10.11 |           8.21 |          x1.23 |
-|     Inception-5h |       35.38 |          37.06 |          x0.95 |
```

Review comment:
what is exactly meant by MKL backend here? I think, instead of putting the table (that can become obsolete rather quickly) into the tutorial, let's just put the link to our wiki with all the measurements.
**File:** doc/tutorials/dnn/dnn_halide/dnn_halide.markdown
**Change Type:** modified
**Context:** PR #9313: Performance test for Caffe efficiency measurements -  ### This pullrequest changes * Added performance test for Caffe * Remove out-date perf...
**Review Line:** 16

**Code Changes:**
```diff
@@ -8,20 +8,7 @@ according to specific device and evaluate it with a quite good efficiency.
 
 An official website of the Halide project: http://halide-lang.org/.
 
-## Efficiency comparison
-Measured on Intel&reg; Core&trade; i7-6700K CPU @ 4.00GHz x 8.
-
-Single image forward pass (in milliseconds):
-
-|     Architecture | MKL backend | Halide backend | Speed Up ratio |
-|-----------------:|------------:|---------------:|---------------:|
-|          AlexNet |       16.55 |          22.38 |          x0.73 |
-|        ResNet-50 |       63.69 |          73.91 |          x0.86 |
-|  SqueezeNet v1.1 |       10.11 |           8.21 |          x1.23 |
-|     Inception-5h |       35.38 |          37.06 |          x0.95 |
```

Review comment:
You're right. This patch removes the old table that was added initially.
**File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #9560: imgproc: add stop criteria tuning in undistortPoints

**Code Changes:**
```diff
@@ -3036,6 +3036,13 @@ cv::stereoRectify can be passed here. If the matrix is empty, the identity new c
 CV_EXPORTS_W void undistortPoints( InputArray src, OutputArray dst,
                                    InputArray cameraMatrix, InputArray distCoeffs,
                                    InputArray R = noArray(), InputArray P = noArray());
+/** @overload
+    @note Default version of cv::undistortPoints does 5 iterations to compute undistorted points.
+
+ */
+CV_EXPORTS_AS(undistortPointsIter) void undistortPoints( InputArray src, OutputArray dst,
+                                   InputArray cameraMatrix, InputArray distCoeffs,
```

Review comment:
I would use suffix Iter instead of Ext. "Ext" is too generic and is not used in OpenCV. Can we make R & P non-optional parameters in this flavor and move the criteria to the end?
**File:** modules/core/src/stat.cpp
**Change Type:** modified
**Context:** PR #9642: Add some useful input assertions to PSNR function - Input arrays must be depth CV_8U and of identical size. Intended this to be part of PR #...

**Code Changes:**
```diff
@@ -4150,7 +4150,9 @@ double cv::PSNR(InputArray _src1, InputArray _src2)
 {
     CV_INSTRUMENT_REGION()
 
-    CV_Assert( _src1.depth() == CV_8U );
+    //Input arrays must have depth CV_8U
+    CV_Assert( _src1.depth() == CV_8U && _src2.depth() == CV_8U );
+
     double diff = std::sqrt(norm(_src1, _src2, NORM_L2SQR)/(_src1.total()*_src1.channels()));
     return 20*log10(255./(diff+DBL_EPSILON));
```

Review comment:
There is no need in the second assert. The function calls cv::norm() which does the same check. When writing high-level functions that are based on lower-level functions, we should rely on the checks that those lower-level functions do, otherwise the code will be flooded with duplicate assert's. The first assert still makes sense because the normalization in PSNR assumes that the arrays are 8-bit.