@@ -419,9 +419,6 @@ static void fixCCS( Mat& mat, int cols, int flags )
419
419
}
420
420
}
421
421
422
- #if defined _MSC_VER && _MSC_VER >= 1700
423
- #pragma optimize("", off)
424
- #endif
425
422
static void mulComplex ( const Mat& src1, const Mat& src2, Mat& dst, int flags )
426
423
{
427
424
dst.create (src1.rows , src1.cols , src1.type ());
@@ -430,12 +427,27 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
430
427
CV_Assert ( src1.size == src2.size && src1.type () == src2.type () &&
431
428
(src1.type () == CV_32FC2 || src1.type () == CV_64FC2) );
432
429
430
+ const Mat* src1_ = &src1;
431
+ Mat src1_tmp;
432
+ if (dst.data == src1.data )
433
+ {
434
+ src1_tmp = src1.clone ();
435
+ src1_ = &src1_tmp;
436
+ }
437
+ const Mat* src2_ = &src2;
438
+ Mat src2_tmp;
439
+ if (dst.data == src2.data )
440
+ {
441
+ src2_tmp = src2.clone ();
442
+ src2_ = &src2_tmp;
443
+ }
444
+
433
445
for ( i = 0 ; i < dst.rows ; i++ )
434
446
{
435
447
if ( depth == CV_32F )
436
448
{
437
- const float * a = src1. ptr <float >(i);
438
- const float * b = src2. ptr <float >(i);
449
+ const float * a = src1_-> ptr <float >(i);
450
+ const float * b = src2_-> ptr <float >(i);
439
451
float * c = dst.ptr <float >(i);
440
452
441
453
if ( !(flags & CV_DXT_MUL_CONJ) )
@@ -459,8 +471,8 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
459
471
}
460
472
else
461
473
{
462
- const double * a = src1. ptr <double >(i);
463
- const double * b = src2. ptr <double >(i);
474
+ const double * a = src1_-> ptr <double >(i);
475
+ const double * b = src2_-> ptr <double >(i);
464
476
double * c = dst.ptr <double >(i);
465
477
466
478
if ( !(flags & CV_DXT_MUL_CONJ) )
@@ -484,9 +496,6 @@ static void mulComplex( const Mat& src1, const Mat& src2, Mat& dst, int flags )
484
496
}
485
497
}
486
498
}
487
- #if defined _MSC_VER && _MSC_VER >= 1700
488
- #pragma optimize("", on)
489
- #endif
490
499
491
500
}
492
501
0 commit comments