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

Method operator()

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

Source from the content-addressed store, hash-verified

414 }
415
416 void operator()(const uchar** src, uchar* dst, int dststep, int count, int width) {
417 int ksize2 = this->ksize / 2;
418 const ST* ky = this->kernel.ptr() + ksize2;
419 int i;
420 ST f0 = ky[0], f1 = ky[1];
421 src += ksize2;
422
423 if (std::is_same<ST, int>::value && std::is_same<DT, uchar>::value) {
424 (this->vec_op)(src, dst, count, width);
425 }
426
427 for (; count > 0; count--, dst += dststep, src++) {
428 DT* D = (DT*)dst;
429 i = (this->vec_op)(src, dst, count, width);
430 if (count == 0)
431 break;
432 const ST* S0 = (const ST*)src[-1];
433 const ST* S1 = (const ST*)src[0];
434 const ST* S2 = (const ST*)src[1];
435
436 {
437#if MEGCV_ENABLE_UNROLLED
438 for (; i <= width - 4; i += 4) {
439 ST s0 = (S0[i] + S2[i]) * f1 + S1[i] * f0;
440 ST s1 = (S0[i + 1] + S2[i + 1]) * f1 + S1[i + 1] * f0;
441 D[i] = this->cast_op(s0);
442 D[i + 1] = this->cast_op(s1);
443
444 s0 = (S0[i + 2] + S2[i + 2]) * f1 + S1[i + 2] * f0;
445 s1 = (S0[i + 3] + S2[i + 3]) * f1 + S1[i + 3] * f0;
446 D[i + 2] = this->cast_op(s0);
447 D[i + 3] = this->cast_op(s1);
448 }
449#endif
450 for (; i < width; i++) {
451 ST s0 = (S0[i] + S2[i]) * f1 + S1[i] * f0;
452 D[i] = this->cast_op(s0);
453 }
454 }
455 }
456 }
457};
458
459/* ============================ Filter Engine ========================= */

Callers

nothing calls this directly

Calls 1

ptrMethod · 0.45

Tested by

no test coverage detected