MCPcopy Create free account
hub / github.com/creatale/node-dv / start

Method start

deps/opencv/modules/imgproc/src/filter.cpp:204–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202static const int VEC_ALIGN = CV_MALLOC_ALIGN;
203
204int FilterEngine::start(Size _wholeSize, Rect _roi, int _maxBufRows)
205{
206 int i, j;
207
208 wholeSize = _wholeSize;
209 roi = _roi;
210 CV_Assert( roi.x >= 0 && roi.y >= 0 && roi.width >= 0 && roi.height >= 0 &&
211 roi.x + roi.width <= wholeSize.width &&
212 roi.y + roi.height <= wholeSize.height );
213
214 int esz = (int)getElemSize(srcType);
215 int bufElemSize = (int)getElemSize(bufType);
216 const uchar* constVal = !constBorderValue.empty() ? &constBorderValue[0] : 0;
217
218 if( _maxBufRows < 0 )
219 _maxBufRows = ksize.height + 3;
220 _maxBufRows = std::max(_maxBufRows, std::max(anchor.y, ksize.height-anchor.y-1)*2+1);
221
222 if( maxWidth < roi.width || _maxBufRows != (int)rows.size() )
223 {
224 rows.resize(_maxBufRows);
225 maxWidth = std::max(maxWidth, roi.width);
226 int cn = CV_MAT_CN(srcType);
227 srcRow.resize(esz*(maxWidth + ksize.width - 1));
228 if( columnBorderType == BORDER_CONSTANT )
229 {
230 constBorderRow.resize(getElemSize(bufType)*(maxWidth + ksize.width - 1 + VEC_ALIGN));
231 uchar *dst = alignPtr(&constBorderRow[0], VEC_ALIGN), *tdst;
232 int n = (int)constBorderValue.size(), N;
233 N = (maxWidth + ksize.width - 1)*esz;
234 tdst = isSeparable() ? &srcRow[0] : dst;
235
236 for( i = 0; i < N; i += n )
237 {
238 n = std::min( n, N - i );
239 for(j = 0; j < n; j++)
240 tdst[i+j] = constVal[j];
241 }
242
243 if( isSeparable() )
244 (*rowFilter)(&srcRow[0], dst, maxWidth, cn);
245 }
246
247 int maxBufStep = bufElemSize*(int)alignSize(maxWidth +
248 (!isSeparable() ? ksize.width - 1 : 0),VEC_ALIGN);
249 ringBuf.resize(maxBufStep*rows.size()+VEC_ALIGN);
250 }
251
252 // adjust bufstep so that the used part of the ring buffer stays compact in memory
253 bufStep = bufElemSize*(int)alignSize(roi.width + (!isSeparable() ? ksize.width - 1 : 0),16);
254
255 dx1 = std::max(anchor.x - roi.x, 0);
256 dx2 = std::max(ksize.width - anchor.x - 1 + roi.x + roi.width - wholeSize.width, 0);
257
258 // recompute border tables
259 if( dx1 > 0 || dx2 > 0 )
260 {
261 if( rowBorderType == BORDER_CONSTANT )

Callers 1

LaplacianMethod · 0.80

Calls 11

alignPtrFunction · 0.85
isSeparableFunction · 0.85
alignSizeFunction · 0.85
getElemSizeFunction · 0.50
maxFunction · 0.50
minFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
resetMethod · 0.45
locateROIMethod · 0.45

Tested by

no test coverage detected