MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / operator()

Method operator()

dnn/src/common/cv/filter.h:306–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304 }
305
306 void operator()(const uchar** src, uchar* dst, int dststep, int count, int width) {
307 const ST* ky = this->kernel.ptr();
308 int i = 0, k;
309 CastOp castOp = this->cast_op;
310 {
311 for (; count > 0; count--, dst += dststep, src++) {
312 DT* D = (DT*)dst;
313 i = (this->vec_op)(src, dst, count, width);
314#if MEGCV_ENABLE_UNROLLED
315 for (; i <= width - 4; i += 4) {
316 ST f = ky[0];
317 const ST* S = (const ST*)src[0] + i;
318 ST s0 = f * S[0], s1 = f * S[1], s2 = f * S[2], s3 = f * S[3];
319
320 for (k = 1; k < ksize; k++) {
321 S = (const ST*)src[k] + i;
322 f = ky[k];
323 s0 += f * S[0];
324 s1 += f * S[1];
325 s2 += f * S[2];
326 s3 += f * S[3];
327 }
328
329 D[i] = castOp(s0);
330 D[i + 1] = castOp(s1);
331 D[i + 2] = castOp(s2);
332 D[i + 3] = castOp(s3);
333 }
334#endif
335 for (; i < width; i++) {
336 ST s0 = 0;
337 for (k = 0; k < ksize; k++) {
338 s0 += ky[k] * ((const ST*)src[k])[i];
339 }
340 D[i] = castOp(s0);
341 }
342 }
343 }
344 }
345
346 Mat<ST> kernel;
347 CastOp cast_op;

Callers

nothing calls this directly

Calls 1

ptrMethod · 0.45

Tested by

no test coverage detected