fix comparison of identicals
authorMike Erwin <significant.bit@gmail.com>
Thu, 21 Jul 2016 22:14:58 +0000 (18:14 -0400)
committerMike Erwin <significant.bit@gmail.com>
Thu, 21 Jul 2016 22:16:08 +0000 (18:16 -0400)
Some of these check that dimensions match before running code that
assumes they do match.

For imb_stereo3d_write_anaglyph I *assume* this change reflects the
intended behavior. Before it was always grabbing alpha from buffer 0.

Found with PVS-Studio T48917

intern/libmv/libmv/numeric/numeric.cc
source/blender/imbuf/intern/filter.c
source/blender/imbuf/intern/stereoimbuf.c

index 9007663c8e2c289ab2df215faf7a94b0f6d32195..3fc1e3b2bfdabf588cbb37f65d8ba703c977e619 100644 (file)
@@ -109,7 +109,7 @@ void MeanAndVarianceAlongRows(const Mat &A,
 }
 
 void HorizontalStack(const Mat &left, const Mat &right, Mat *stacked) {
-  assert(left.rows() == left.rows());
+  assert(left.rows() == right.rows());
   int n = left.rows();
   int m1 = left.cols();
   int m2 = right.cols();
index 26ced49a333ff3f7a36f36a44e17e0d2a42f1e98..1987c6d2a9aed526b91520806f3a1a5ce0d05b06 100644 (file)
@@ -206,7 +206,7 @@ void imb_filterx(struct ImBuf *ibuf)
 static void imb_filterN(ImBuf *out, ImBuf *in)
 {
        BLI_assert(out->channels == in->channels);
-       BLI_assert(out->x == in->x && out->y == out->y);
+       BLI_assert(out->x == in->x && out->y == in->y);
 
        const int channels = in->channels;
        const int rowlen = in->x;
index a55cef609436bfb23594df3b1eb33c26ce91792f..a4418443790a13feb936c8b10c96e819f8205507 100644 (file)
@@ -117,7 +117,7 @@ static void imb_stereo3d_write_anaglyph(Stereo3DData *s3d, enum eStereo3dAnaglyp
                                        to[0] = from[r][0];
                                        to[1] = from[g][1];
                                        to[2] = from[b][2];
-                                       to[3] = MAX2(from[0][3], from[0][3]);
+                                       to[3] = MAX2(from[0][3], from[1][3]);
                                }
                        }
                }
@@ -154,7 +154,7 @@ static void imb_stereo3d_write_anaglyph(Stereo3DData *s3d, enum eStereo3dAnaglyp
                                        to[0] = from[r][0];
                                        to[1] = from[g][1];
                                        to[2] = from[b][2];
-                                       to[3] = MAX2(from[0][3], from[0][3]);
+                                       to[3] = MAX2(from[0][3], from[1][3]);
                                }
                        }
                }