MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / build_tabs_linear_32f

Function build_tabs_linear_32f

dnn/src/arm_common/resize/resize_cv.cpp:187–227  ·  view source on GitHub ↗

linear 32f

Source from the content-addressed store, hash-verified

185
186// linear 32f
187void build_tabs_linear_32f(
188 const Mat32f& src, const Mat32f& dst, AlignedVector<int>& tabsx,
189 AlignedVector<int>& tabsy, AlignedVector<float>& tabrx,
190 AlignedVector<float>& tabry) {
191 megdnn_assert(src.rows() >= 2);
192 megdnn_assert(src.cols() >= 2);
193 megdnn_assert(dst.rows() >= 2);
194 megdnn_assert(dst.cols() >= 2);
195 const float fx = static_cast<float>(dst.rows()) / src.rows();
196 const float fy = static_cast<float>(dst.cols()) / src.cols();
197 const float ifx = 1.0f / fx;
198 const float ify = 1.0f / fy;
199 for (size_t dx = 0; dx < dst.rows(); ++dx) {
200 float rx = (dx + 0.5f) * ifx - 0.5f;
201 int sx = static_cast<int>(floor(rx));
202 rx -= sx;
203 if (sx < 0) {
204 sx = 0;
205 rx = 0;
206 } else if (sx + 1 >= static_cast<int>(src.rows())) {
207 sx = src.rows() - 2;
208 rx = 1;
209 }
210 tabsx[dx] = sx;
211 tabrx[dx] = rx;
212 }
213 for (size_t dy = 0; dy < dst.cols(); ++dy) {
214 float ry = (dy + 0.5f) * ify - 0.5f;
215 int sy = static_cast<int>(floor(ry));
216 ry -= sy;
217 if (sy < 0) {
218 sy = 0;
219 ry = 0;
220 } else if (sy + 1 >= static_cast<int>(src.cols())) {
221 sy = src.cols() - 2;
222 ry = 1;
223 }
224 tabsy[dy] = sy;
225 tabry[dy] = ry;
226 }
227}
228
229void calc_cache_linear_32fc1_1(
230 const Mat32f& src, const Mat32f& dst, const AlignedVector<int>& tabsx,

Callers 1

resize_linear_32f_neonFunction · 0.70

Calls 3

floorFunction · 0.50
rowsMethod · 0.45
colsMethod · 0.45

Tested by

no test coverage detected