Skip to content

Commit ca1a0a1

Browse files
tomoaki0705vpisarev
authored andcommitted
core: remove raw SSE2/NEON implementation from convert.cpp (opencv#9831)
* remove raw SSE2/NEON implementation from convert.cpp * remove raw implementation from Cvt_SIMD * remove raw implementation from cvtScale_SIMD * remove raw implementation from cvtScaleAbs_SIMD * remove duplicated implementation cvt_<float, short> * remove duplicated implementation cvtScale_<short, short, float> * add "from double" version of Cvt_SIMD * modify the condition of test ConvertScaleAbs * Update convert.cpp fixed crash in cvtScaleAbs(8s=>8u) * fixed compile error on Win32 * fixed several test failures because of accuracy loss in cvtScale(int=>int) * fixed NEON implementation of v_cvt_f64(int=>double) intrinsic * another attempt to fix test failures * keep trying to fix the test failures and just introduced compile warnings * fixed one remaining test (subtractScalar)
1 parent 6cedc82 commit ca1a0a1

File tree

3 files changed

+1297
-2345
lines changed

3 files changed

+1297
-2345
lines changed

modules/core/perf/perf_arithm.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,18 @@ PERF_TEST_P(Size_MatType, absdiff, TYPICAL_MATS_CORE_ARITHM)
8080

8181
declare.in(a, b, WARMUP_RNG).out(c);
8282

83+
double eps = 1e-8;
8384
if (CV_MAT_DEPTH(type) == CV_32S)
8485
{
8586
//see ticket 1529: absdiff can be without saturation on 32S
8687
a /= 2;
8788
b /= 2;
89+
eps = 1;
8890
}
8991

9092
TEST_CYCLE() absdiff(a, b, c);
9193

92-
SANITY_CHECK(c, 1e-8);
94+
SANITY_CHECK(c, eps);
9395
}
9496

9597
PERF_TEST_P(Size_MatType, absdiffScalar, TYPICAL_MATS_CORE_ARITHM)
@@ -102,16 +104,18 @@ PERF_TEST_P(Size_MatType, absdiffScalar, TYPICAL_MATS_CORE_ARITHM)
102104

103105
declare.in(a, b, WARMUP_RNG).out(c);
104106

107+
double eps = 1e-8;
105108
if (CV_MAT_DEPTH(type) == CV_32S)
106109
{
107110
//see ticket 1529: absdiff can be without saturation on 32S
108111
a /= 2;
109112
b /= 2;
113+
eps = 1;
110114
}
111115

112116
TEST_CYCLE() absdiff(a, b, c);
113117

114-
SANITY_CHECK(c, 1e-8);
118+
SANITY_CHECK(c, eps);
115119
}
116120

117121
PERF_TEST_P(Size_MatType, add, TYPICAL_MATS_CORE_ARITHM)
@@ -125,16 +129,18 @@ PERF_TEST_P(Size_MatType, add, TYPICAL_MATS_CORE_ARITHM)
125129
declare.in(a, b, WARMUP_RNG).out(c);
126130
declare.time(50);
127131

132+
double eps = 1e-8;
128133
if (CV_MAT_DEPTH(type) == CV_32S)
129134
{
130135
//see ticket 1529: add can be without saturation on 32S
131136
a /= 2;
132137
b /= 2;
138+
eps = 1;
133139
}
134140

135141
TEST_CYCLE() add(a, b, c);
136142

137-
SANITY_CHECK(c, 1e-8);
143+
SANITY_CHECK(c, eps);
138144
}
139145

140146
PERF_TEST_P(Size_MatType, addScalar, TYPICAL_MATS_CORE_ARITHM)
@@ -147,16 +153,18 @@ PERF_TEST_P(Size_MatType, addScalar, TYPICAL_MATS_CORE_ARITHM)
147153

148154
declare.in(a, b, WARMUP_RNG).out(c);
149155

156+
double eps = 1e-8;
150157
if (CV_MAT_DEPTH(type) == CV_32S)
151158
{
152159
//see ticket 1529: add can be without saturation on 32S
153160
a /= 2;
154161
b /= 2;
162+
eps = 1;
155163
}
156164

157165
TEST_CYCLE() add(a, b, c);
158166

159-
SANITY_CHECK(c, 1e-8);
167+
SANITY_CHECK(c, eps);
160168
}
161169

162170
PERF_TEST_P(Size_MatType, subtract, TYPICAL_MATS_CORE_ARITHM)
@@ -169,16 +177,18 @@ PERF_TEST_P(Size_MatType, subtract, TYPICAL_MATS_CORE_ARITHM)
169177

170178
declare.in(a, b, WARMUP_RNG).out(c);
171179

180+
double eps = 1e-8;
172181
if (CV_MAT_DEPTH(type) == CV_32S)
173182
{
174183
//see ticket 1529: subtract can be without saturation on 32S
175184
a /= 2;
176185
b /= 2;
186+
eps = 1;
177187
}
178188

179189
TEST_CYCLE() subtract(a, b, c);
180190

181-
SANITY_CHECK(c, 1e-8);
191+
SANITY_CHECK(c, eps);
182192
}
183193

184194
PERF_TEST_P(Size_MatType, subtractScalar, TYPICAL_MATS_CORE_ARITHM)
@@ -191,16 +201,18 @@ PERF_TEST_P(Size_MatType, subtractScalar, TYPICAL_MATS_CORE_ARITHM)
191201

192202
declare.in(a, b, WARMUP_RNG).out(c);
193203

204+
double eps = 1e-8;
194205
if (CV_MAT_DEPTH(type) == CV_32S)
195206
{
196207
//see ticket 1529: subtract can be without saturation on 32S
197208
a /= 2;
198209
b /= 2;
210+
eps = 1;
199211
}
200212

201213
TEST_CYCLE() subtract(a, b, c);
202214

203-
SANITY_CHECK(c, 1e-8);
215+
SANITY_CHECK(c, eps);
204216
}
205217

206218
PERF_TEST_P(Size_MatType, multiply, TYPICAL_MATS_CORE_ARITHM)

0 commit comments

Comments
 (0)