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

Method operator()

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

Source from the content-addressed store, hash-verified

191 }
192
193 void operator()(const uchar* src, uchar* dst, int width, int cn) {
194 const DT* kx = kernel.ptr();
195 const ST* S;
196 DT* D = reinterpret_cast<DT*>(dst);
197 int i, k;
198
199 i = vec_op(src, dst, width, cn);
200 width *= cn;
201#if MEGCV_ENABLE_UNROLLED
202 for (; i <= width - 4; i += 4) {
203 S = reinterpret_cast<const ST*>(src) + i;
204 DT f = kx[0];
205 DT s0 = f * S[0], s1 = f * S[1], s2 = f * S[2], s3 = f * S[3];
206
207 for (k = 1; k < ksize; k++) {
208 S += cn;
209 f = kx[k];
210 s0 += f * S[0];
211 s1 += f * S[1];
212 s2 += f * S[2];
213 s3 += f * S[3];
214 }
215
216 D[i] = s0;
217 D[i + 1] = s1;
218 D[i + 2] = s2;
219 D[i + 3] = s3;
220 }
221#endif
222 for (; i < width; i++) {
223 S = reinterpret_cast<const ST*>(src) + i;
224 DT s0 = kx[0] * S[0];
225 for (k = 1; k < ksize; k++) {
226 S += cn;
227 s0 += kx[k] * S[0];
228 }
229 D[i] = s0;
230 }
231 }
232
233 //! The kernel used in RowFilter
234 Mat<DT> kernel;

Callers

nothing calls this directly

Calls 1

ptrMethod · 0.45

Tested by

no test coverage detected