Skip to content

Commit 9079d9c

Browse files
committed
let the test OCL_Filter/Bilateral pass
* avoid aggressive optimization on Visual Studio 2012 Update 5 * add code branch to avoid unattended optimization (keep the old code)
1 parent 90ff900 commit 9079d9c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

modules/imgproc/src/smooth.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4674,11 +4674,17 @@ class BilateralFilter_8u_Invoker :
46744674
color_weight[buf[2]],
46754675
color_weight[buf[3]]);
46764676
v_float32x4 _sw = v_load(space_weight+k);
4677+
#if defined(_MSC_VER) && _MSC_VER == 1700/* MSVS 2012 */ && CV_AVX
4678+
// details: https://github.com/opencv/opencv/issues/11004
4679+
vsumw += _cw * _sw;
4680+
vsumc += _cw * _sw * _valF;
4681+
#else
46774682
v_float32x4 _w = _cw * _sw;
46784683
_cw = _w * _valF;
46794684

46804685
vsumw += _w;
46814686
vsumc += _cw;
4687+
#endif
46824688
}
46834689
float *bufFloat = (float*)buf;
46844690
v_float32x4 sum4 = v_reduce_sum4(vsumw, vsumc, vsumw, vsumc);
@@ -4743,6 +4749,13 @@ class BilateralFilter_8u_Invoker :
47434749
color_weight[buf[2]],color_weight[buf[3]]);
47444750
v_float32x4 _sw = v_load(space_weight+k);
47454751

4752+
#if defined(_MSC_VER) && _MSC_VER == 1700/* MSVS 2012 */ && CV_AVX
4753+
// details: https://github.com/opencv/opencv/issues/11004
4754+
vsumw += _w * _sw;
4755+
vsumb += _w * _sw * _b;
4756+
vsumg += _w * _sw * _g;
4757+
vsumr += _w * _sw * _r;
4758+
#else
47464759
_w *= _sw;
47474760
_b *= _w;
47484761
_g *= _w;
@@ -4752,6 +4765,7 @@ class BilateralFilter_8u_Invoker :
47524765
vsumb += _b;
47534766
vsumg += _g;
47544767
vsumr += _r;
4768+
#endif
47554769
}
47564770
float *bufFloat = (float*)buf;
47574771
v_float32x4 sum4 = v_reduce_sum4(vsumw, vsumb, vsumg, vsumr);

0 commit comments

Comments
 (0)