mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
opencv: Use cv::AutoBuffer<>::data()
This commit is contained in:
committed by
Alexander Alekhin
parent
135ea264ef
commit
b09a4a98d4
@@ -63,7 +63,7 @@ CvSeq* icvApproximateChainTC89( CvChain* chain, int header_size,
|
||||
cv::AutoBuffer<_CvPtInfo> buf(chain->total + 8);
|
||||
|
||||
_CvPtInfo temp;
|
||||
_CvPtInfo *array = buf, *first = 0, *current = 0, *prev_current = 0;
|
||||
_CvPtInfo *array = buf.data(), *first = 0, *current = 0, *prev_current = 0;
|
||||
int i, j, i1, i2, s, len;
|
||||
int count = chain->total;
|
||||
|
||||
@@ -475,14 +475,14 @@ namespace cv
|
||||
|
||||
template<typename T> static int
|
||||
approxPolyDP_( const Point_<T>* src_contour, int count0, Point_<T>* dst_contour,
|
||||
bool is_closed0, double eps, AutoBuffer<Range>* _stack )
|
||||
bool is_closed0, double eps, AutoBuffer<Range>& _stack )
|
||||
{
|
||||
#define PUSH_SLICE(slice) \
|
||||
if( top >= stacksz ) \
|
||||
{ \
|
||||
_stack->resize(stacksz*3/2); \
|
||||
stack = *_stack; \
|
||||
stacksz = _stack->size(); \
|
||||
_stack.resize(stacksz*3/2); \
|
||||
stack = _stack.data(); \
|
||||
stacksz = _stack.size(); \
|
||||
} \
|
||||
stack[top++] = slice
|
||||
|
||||
@@ -504,8 +504,8 @@ approxPolyDP_( const Point_<T>* src_contour, int count0, Point_<T>* dst_contour,
|
||||
int i = 0, j, pos = 0, wpos, count = count0, new_count=0;
|
||||
int is_closed = is_closed0;
|
||||
bool le_eps = false;
|
||||
size_t top = 0, stacksz = _stack->size();
|
||||
Range* stack = *_stack;
|
||||
size_t top = 0, stacksz = _stack.size();
|
||||
Range* stack = _stack.data();
|
||||
|
||||
if( count == 0 )
|
||||
return 0;
|
||||
@@ -689,13 +689,13 @@ void cv::approxPolyDP( InputArray _curve, OutputArray _approxCurve,
|
||||
|
||||
AutoBuffer<Point> _buf(npoints);
|
||||
AutoBuffer<Range> _stack(npoints);
|
||||
Point* buf = _buf;
|
||||
Point* buf = _buf.data();
|
||||
int nout = 0;
|
||||
|
||||
if( depth == CV_32S )
|
||||
nout = approxPolyDP_(curve.ptr<Point>(), npoints, buf, closed, epsilon, &_stack);
|
||||
nout = approxPolyDP_(curve.ptr<Point>(), npoints, buf, closed, epsilon, _stack);
|
||||
else if( depth == CV_32F )
|
||||
nout = approxPolyDP_(curve.ptr<Point2f>(), npoints, (Point2f*)buf, closed, epsilon, &_stack);
|
||||
nout = approxPolyDP_(curve.ptr<Point2f>(), npoints, (Point2f*)buf, closed, epsilon, _stack);
|
||||
else
|
||||
CV_Error( CV_StsUnsupportedFormat, "" );
|
||||
|
||||
@@ -783,7 +783,7 @@ cvApproxPoly( const void* array, int header_size,
|
||||
{
|
||||
int npoints = src_seq->total, nout = 0;
|
||||
_buf.allocate(npoints*2);
|
||||
cv::Point *src = _buf, *dst = src + npoints;
|
||||
cv::Point *src = _buf.data(), *dst = src + npoints;
|
||||
bool closed = CV_IS_SEQ_CLOSED(src_seq);
|
||||
|
||||
if( src_seq->first->next == src_seq->first )
|
||||
@@ -792,10 +792,10 @@ cvApproxPoly( const void* array, int header_size,
|
||||
cvCvtSeqToArray(src_seq, src);
|
||||
|
||||
if( CV_SEQ_ELTYPE(src_seq) == CV_32SC2 )
|
||||
nout = cv::approxPolyDP_(src, npoints, dst, closed, parameter, &stack);
|
||||
nout = cv::approxPolyDP_(src, npoints, dst, closed, parameter, stack);
|
||||
else if( CV_SEQ_ELTYPE(src_seq) == CV_32FC2 )
|
||||
nout = cv::approxPolyDP_((cv::Point2f*)src, npoints,
|
||||
(cv::Point2f*)dst, closed, parameter, &stack);
|
||||
(cv::Point2f*)dst, closed, parameter, stack);
|
||||
else
|
||||
CV_Error( CV_StsUnsupportedFormat, "" );
|
||||
|
||||
|
||||
@@ -390,21 +390,21 @@ public:
|
||||
{
|
||||
dxMax.allocate(2 * dx.cols);
|
||||
dyMax.allocate(2 * dy.cols);
|
||||
_dx_a = (short*)dxMax;
|
||||
_dx_a = dxMax.data();
|
||||
_dx_n = _dx_a + dx.cols;
|
||||
_dy_a = (short*)dyMax;
|
||||
_dy_a = dyMax.data();
|
||||
_dy_n = _dy_a + dy.cols;
|
||||
}
|
||||
|
||||
// _mag_p: previous row, _mag_a: actual row, _mag_n: next row
|
||||
#if CV_SIMD128
|
||||
AutoBuffer<int> buffer(3 * (mapstep * cn + CV_MALLOC_SIMD128));
|
||||
_mag_p = alignPtr((int*)buffer + 1, CV_MALLOC_SIMD128);
|
||||
_mag_p = alignPtr(buffer.data() + 1, CV_MALLOC_SIMD128);
|
||||
_mag_a = alignPtr(_mag_p + mapstep * cn, CV_MALLOC_SIMD128);
|
||||
_mag_n = alignPtr(_mag_a + mapstep * cn, CV_MALLOC_SIMD128);
|
||||
#else
|
||||
AutoBuffer<int> buffer(3 * (mapstep * cn));
|
||||
_mag_p = (int*)buffer + 1;
|
||||
_mag_p = buffer.data() + 1;
|
||||
_mag_a = _mag_p + mapstep * cn;
|
||||
_mag_n = _mag_a + mapstep * cn;
|
||||
#endif
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace
|
||||
src_(src), dst_(dst), lut_(lut), tileSize_(tileSize), tilesX_(tilesX), tilesY_(tilesY)
|
||||
{
|
||||
buf.allocate(src.cols << 2);
|
||||
ind1_p = (int *)buf;
|
||||
ind1_p = buf.data();
|
||||
ind2_p = ind1_p + src.cols;
|
||||
xa_p = (float *)(ind2_p + src.cols);
|
||||
xa1_p = xa_p + src.cols;
|
||||
|
||||
@@ -1398,7 +1398,7 @@ static LABLUVLUT_s16_t initLUTforLABLUVs16(const softfloat & un, const softfloat
|
||||
for (int p_ = 0; p_ < 2; ++p_)
|
||||
for (int q_ = 0; q_ < 2; ++q_)
|
||||
for (int r_ = 0; r_ < 2; ++r_)
|
||||
fill_one(RGB2LabLUT_s16, RGB2Labprev, RGB2LuvLUT_s16, RGB2Luvprev, p, q, r, p_, q_, r_);
|
||||
fill_one(RGB2LabLUT_s16, RGB2Labprev.data(), RGB2LuvLUT_s16, RGB2Luvprev.data(), p, q, r, p_, q_, r_);
|
||||
LABLUVLUT_s16_t res;
|
||||
res.RGB2LabLUT_s16 = RGB2LabLUT_s16;
|
||||
res.RGB2LuvLUT_s16 = RGB2LuvLUT_s16;
|
||||
|
||||
@@ -147,11 +147,11 @@ void convexHull( InputArray _points, OutputArray _hull, bool clockwise, bool ret
|
||||
bool is_float = depth == CV_32F;
|
||||
AutoBuffer<Point*> _pointer(total);
|
||||
AutoBuffer<int> _stack(total + 2), _hullbuf(total);
|
||||
Point** pointer = _pointer;
|
||||
Point** pointer = _pointer.data();
|
||||
Point2f** pointerf = (Point2f**)pointer;
|
||||
Point* data0 = points.ptr<Point>();
|
||||
int* stack = _stack;
|
||||
int* hullbuf = _hullbuf;
|
||||
int* stack = _stack.data();
|
||||
int* hullbuf = _hullbuf.data();
|
||||
|
||||
CV_Assert(points.isContinuous());
|
||||
|
||||
|
||||
@@ -542,7 +542,7 @@ static bool ipp_cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockS
|
||||
if (ok >= 0)
|
||||
{
|
||||
AutoBuffer<uchar> buffer(bufferSize);
|
||||
ok = CV_INSTRUMENT_FUN_IPP(ippiMinEigenVal_C1R, src.ptr(), (int) src.step, dst.ptr<Ipp32f>(), (int) dst.step, srcRoi, kerType, kerSize, blockSize, buffer);
|
||||
ok = CV_INSTRUMENT_FUN_IPP(ippiMinEigenVal_C1R, src.ptr(), (int) src.step, dst.ptr<Ipp32f>(), (int) dst.step, srcRoi, kerType, kerSize, blockSize, buffer.data());
|
||||
CV_SUPPRESS_DEPRECATED_START
|
||||
if (ok >= 0) ok = CV_INSTRUMENT_FUN_IPP(ippiMulC_32f_C1IR, norm_coef, dst.ptr<Ipp32f>(), (int) dst.step, srcRoi);
|
||||
CV_SUPPRESS_DEPRECATED_END
|
||||
|
||||
@@ -976,7 +976,7 @@ static void Bayer2RGB_VNG_8u( const Mat& srcmat, Mat& dstmat, int code )
|
||||
int N = size.width, N2 = N*2, N3 = N*3, N4 = N*4, N5 = N*5, N6 = N*6, N7 = N*7;
|
||||
int i, bufstep = N7*bcn;
|
||||
cv::AutoBuffer<ushort> _buf(bufstep*brows);
|
||||
ushort* buf = (ushort*)_buf;
|
||||
ushort* buf = _buf.data();
|
||||
|
||||
bayer += bstep*2;
|
||||
|
||||
|
||||
@@ -458,7 +458,7 @@ struct DTColumnInvoker : ParallelLoopBody
|
||||
int m = src->rows;
|
||||
size_t sstep = src->step, dstep = dst->step/sizeof(float);
|
||||
AutoBuffer<int> _d(m);
|
||||
int* d = _d;
|
||||
int* d = _d.data();
|
||||
|
||||
for( i = i1; i < i2; i++ )
|
||||
{
|
||||
@@ -503,7 +503,7 @@ struct DTRowInvoker : ParallelLoopBody
|
||||
int i, i1 = range.start, i2 = range.end;
|
||||
int n = dst->cols;
|
||||
AutoBuffer<uchar> _buf((n+2)*2*sizeof(float) + (n+2)*sizeof(int));
|
||||
float* f = (float*)(uchar*)_buf;
|
||||
float* f = (float*)_buf.data();
|
||||
float* z = f + n;
|
||||
int* v = alignPtr((int*)(z + n + 1), sizeof(int));
|
||||
|
||||
@@ -564,7 +564,7 @@ trueDistTrans( const Mat& src, Mat& dst )
|
||||
|
||||
cv::AutoBuffer<uchar> _buf(std::max(m*2*sizeof(float) + (m*3+1)*sizeof(int), n*2*sizeof(float)));
|
||||
// stage 1: compute 1d distance transform of each column
|
||||
float* sqr_tab = (float*)(uchar*)_buf;
|
||||
float* sqr_tab = (float*)_buf.data();
|
||||
int* sat_tab = cv::alignPtr((int*)(sqr_tab + m*2), sizeof(int));
|
||||
int shift = m*2;
|
||||
|
||||
|
||||
@@ -2398,8 +2398,8 @@ void cv::fillPoly(InputOutputArray _img, InputArrayOfArrays pts,
|
||||
return;
|
||||
AutoBuffer<Point*> _ptsptr(ncontours);
|
||||
AutoBuffer<int> _npts(ncontours);
|
||||
Point** ptsptr = _ptsptr;
|
||||
int* npts = _npts;
|
||||
Point** ptsptr = _ptsptr.data();
|
||||
int* npts = _npts.data();
|
||||
|
||||
for( i = 0; i < ncontours; i++ )
|
||||
{
|
||||
@@ -2426,8 +2426,8 @@ void cv::polylines(InputOutputArray _img, InputArrayOfArrays pts,
|
||||
return;
|
||||
AutoBuffer<Point*> _ptsptr(ncontours);
|
||||
AutoBuffer<int> _npts(ncontours);
|
||||
Point** ptsptr = _ptsptr;
|
||||
int* npts = _npts;
|
||||
Point** ptsptr = _ptsptr.data();
|
||||
int* npts = _npts.data();
|
||||
|
||||
for( i = 0; i < ncontours; i++ )
|
||||
{
|
||||
|
||||
@@ -359,7 +359,7 @@ static int icvInitEMD( const float* signature1, int size1,
|
||||
/* allocate buffers */
|
||||
_buffer.allocate(buffer_size);
|
||||
|
||||
state->buffer = buffer = _buffer;
|
||||
state->buffer = buffer = _buffer.data();
|
||||
buffer_end = buffer + buffer_size;
|
||||
|
||||
state->idx1 = (int*) buffer;
|
||||
|
||||
@@ -1444,7 +1444,7 @@ private:
|
||||
return 0;
|
||||
}
|
||||
AutoBuffer<uchar> buf(bufsz + 64);
|
||||
uchar* bufptr = alignPtr((uchar*)buf, 32);
|
||||
uchar* bufptr = alignPtr(buf.data(), 32);
|
||||
int step = (int)(width*sizeof(dst[0])*cn);
|
||||
float borderValue[] = {0.f, 0.f, 0.f};
|
||||
// here is the trick. IPP needs border type and extrapolates the row. We did it already.
|
||||
|
||||
@@ -524,7 +524,7 @@ float cv::intersectConvexConvex( InputArray _p1, InputArray _p2, OutputArray _p1
|
||||
}
|
||||
|
||||
AutoBuffer<Point2f> _result(n*2 + m*2 + 1);
|
||||
Point2f *fp1 = _result, *fp2 = fp1 + n;
|
||||
Point2f *fp1 = _result.data(), *fp2 = fp1 + n;
|
||||
Point2f* result = fp2 + m;
|
||||
int orientation = 0;
|
||||
|
||||
|
||||
@@ -165,11 +165,11 @@ HoughLinesStandard( InputArray src, OutputArray lines, int type,
|
||||
AutoBuffer<float> _tabSin(numangle);
|
||||
AutoBuffer<float> _tabCos(numangle);
|
||||
int *accum = _accum.ptr<int>();
|
||||
float *tabSin = _tabSin, *tabCos = _tabCos;
|
||||
float *tabSin = _tabSin.data(), *tabCos = _tabCos.data();
|
||||
|
||||
// create sin and cos table
|
||||
createTrigTable( numangle, min_theta, theta,
|
||||
irho, tabSin, tabCos );
|
||||
irho, tabSin, tabCos);
|
||||
|
||||
// stage 1. fill accumulator
|
||||
for( i = 0; i < height; i++ )
|
||||
@@ -963,7 +963,7 @@ void HoughLinesPointSet( InputArray _point, OutputArray _lines, int lines_max, i
|
||||
AutoBuffer<float> _tabSin(numangle);
|
||||
AutoBuffer<float> _tabCos(numangle);
|
||||
int *accum = _accum.ptr<int>();
|
||||
float *tabSin = _tabSin, *tabCos = _tabCos;
|
||||
float *tabSin = _tabSin.data(), *tabCos = _tabCos.data();
|
||||
|
||||
// create sin and cos table
|
||||
createTrigTable( numangle, min_theta, theta_step,
|
||||
@@ -1408,8 +1408,8 @@ protected:
|
||||
int nBins = cvRound((maxRadius - minRadius)/dr*nBinsPerDr);
|
||||
AutoBuffer<int> bins(nBins);
|
||||
AutoBuffer<float> distBuf(nzSz), distSqrtBuf(nzSz);
|
||||
float *ddata = distBuf;
|
||||
float *dSqrtData = distSqrtBuf;
|
||||
float *ddata = distBuf.data();
|
||||
float *dSqrtData = distSqrtBuf.data();
|
||||
|
||||
bool singleThread = (boundaries == Range(0, centerSz));
|
||||
int i = boundaries.start;
|
||||
@@ -1434,7 +1434,7 @@ protected:
|
||||
Mat_<float> distSqrtMat(1, nzCount, dSqrtData);
|
||||
sqrt(distMat, distSqrtMat);
|
||||
|
||||
memset(bins, 0, sizeof(bins[0])*bins.size());
|
||||
memset(bins.data(), 0, sizeof(bins[0])*bins.size());
|
||||
for(int k = 0; k < nzCount; k++)
|
||||
{
|
||||
int bin = std::max(0, std::min(nBins-1, cvRound((dSqrtData[k] - minRadius)/dr*nBinsPerDr)));
|
||||
|
||||
@@ -228,7 +228,7 @@ static const void* initInterTab2D( int method, bool fixpt )
|
||||
{
|
||||
AutoBuffer<float> _tab(8*INTER_TAB_SIZE);
|
||||
int i, j, k1, k2;
|
||||
initInterTab1D(method, _tab, INTER_TAB_SIZE);
|
||||
initInterTab1D(method, _tab.data(), INTER_TAB_SIZE);
|
||||
for( i = 0; i < INTER_TAB_SIZE; i++ )
|
||||
for( j = 0; j < INTER_TAB_SIZE; j++, tab += ksize*ksize, itab += ksize*ksize )
|
||||
{
|
||||
|
||||
@@ -360,7 +360,7 @@ static void fitLine2D( const Point2f * points, int count, int dist,
|
||||
}
|
||||
|
||||
AutoBuffer<float> wr(count*2);
|
||||
float *w = wr, *r = w + count;
|
||||
float *w = wr.data(), *r = w + count;
|
||||
|
||||
for( k = 0; k < 20; k++ )
|
||||
{
|
||||
@@ -495,7 +495,7 @@ static void fitLine3D( Point3f * points, int count, int dist,
|
||||
}
|
||||
|
||||
AutoBuffer<float> buf(count*2);
|
||||
float *w = buf, *r = w + count;
|
||||
float *w = buf.data(), *r = w + count;
|
||||
|
||||
for( k = 0; k < 20; k++ )
|
||||
{
|
||||
|
||||
@@ -607,7 +607,7 @@ void cv::createHanningWindow(OutputArray _dst, cv::Size winSize, int type)
|
||||
int rows = dst.rows, cols = dst.cols;
|
||||
|
||||
AutoBuffer<double> _wc(cols);
|
||||
double * const wc = (double *)_wc;
|
||||
double* const wc = _wc.data();
|
||||
|
||||
double coeff0 = 2.0 * CV_PI / (double)(cols - 1), coeff1 = 2.0f * CV_PI / (double)(rows - 1);
|
||||
for(int j = 0; j < cols; j++)
|
||||
|
||||
@@ -860,10 +860,10 @@ pyrDown_( const Mat& _src, Mat& _dst, int borderType )
|
||||
int cn = _src.channels();
|
||||
int bufstep = (int)alignSize(dsize.width*cn, 16);
|
||||
AutoBuffer<WT> _buf(bufstep*PD_SZ + 16);
|
||||
WT* buf = alignPtr((WT*)_buf, 16);
|
||||
WT* buf = alignPtr((WT*)_buf.data(), 16);
|
||||
int tabL[CV_CN_MAX*(PD_SZ+2)], tabR[CV_CN_MAX*(PD_SZ+2)];
|
||||
AutoBuffer<int> _tabM(dsize.width*cn);
|
||||
int* tabM = _tabM;
|
||||
int* tabM = _tabM.data();
|
||||
WT* rows[PD_SZ];
|
||||
CastOp castOp;
|
||||
VecOp vecOp;
|
||||
@@ -984,9 +984,9 @@ pyrUp_( const Mat& _src, Mat& _dst, int)
|
||||
int cn = _src.channels();
|
||||
int bufstep = (int)alignSize((dsize.width+1)*cn, 16);
|
||||
AutoBuffer<WT> _buf(bufstep*PU_SZ + 16);
|
||||
WT* buf = alignPtr((WT*)_buf, 16);
|
||||
WT* buf = alignPtr((WT*)_buf.data(), 16);
|
||||
AutoBuffer<int> _dtab(ssize.width*cn);
|
||||
int* dtab = _dtab;
|
||||
int* dtab = _dtab.data();
|
||||
WT* rows[PU_SZ];
|
||||
T* dsts[2];
|
||||
CastOp castOp;
|
||||
|
||||
@@ -686,18 +686,18 @@ public:
|
||||
{
|
||||
last_eval = 1 - interp_y_len;
|
||||
evalbuf_start = 1;
|
||||
hResize((ET*)src, cn, xoffsets, xcoeffs, (fixedpoint*)linebuf, min_x, max_x, dst_width);
|
||||
hResize((ET*)src, cn, xoffsets, xcoeffs, linebuf.data(), min_x, max_x, dst_width);
|
||||
}
|
||||
int dy = range.start;
|
||||
for (; dy < rmin_y; dy++)
|
||||
vlineSet<ET, FT>((fixedpoint*)linebuf, (ET*)(dst + dst_step * dy), dst_width*cn);
|
||||
vlineSet<ET, FT>(linebuf.data(), (ET*)(dst + dst_step * dy), dst_width*cn);
|
||||
for (; dy < rmax_y; dy++)
|
||||
{
|
||||
int &iy = yoffsets[dy];
|
||||
|
||||
int i;
|
||||
for (i = max(iy, last_eval + interp_y_len); i < min(iy + interp_y_len, src_height); i++, evalbuf_start = (evalbuf_start + 1) % interp_y_len)
|
||||
hResize((ET*)(src + i * src_step), cn, xoffsets, xcoeffs, (fixedpoint*)linebuf + evalbuf_start*(dst_width * cn), min_x, max_x, dst_width);
|
||||
hResize((ET*)(src + i * src_step), cn, xoffsets, xcoeffs, linebuf.data() + evalbuf_start*(dst_width * cn), min_x, max_x, dst_width);
|
||||
evalbuf_start = (evalbuf_start + max(iy, src_height - interp_y_len) - max(last_eval, src_height - interp_y_len)) % interp_y_len;
|
||||
last_eval = iy;
|
||||
|
||||
@@ -707,9 +707,9 @@ public:
|
||||
for (; i < interp_y_len; i++)
|
||||
curcoeffs[i] = ycoeffs[ dy*interp_y_len - evalbuf_start + i];
|
||||
|
||||
vlineResize<ET, FT, interp_y_len>((fixedpoint*)linebuf, dst_width*cn, curcoeffs, (ET*)(dst + dst_step * dy), dst_width*cn);
|
||||
vlineResize<ET, FT, interp_y_len>(linebuf.data(), dst_width*cn, curcoeffs, (ET*)(dst + dst_step * dy), dst_width*cn);
|
||||
}
|
||||
fixedpoint *endline = (fixedpoint*)linebuf;
|
||||
fixedpoint *endline = linebuf.data();
|
||||
if (last_eval + interp_y_len > src_height)
|
||||
endline += dst_width*cn*((evalbuf_start + src_height - 1 - last_eval) % interp_y_len);
|
||||
else
|
||||
@@ -757,7 +757,7 @@ void resize_bitExact(const uchar* src, size_t src_step, int src_width, int src_h
|
||||
dst_height * sizeof(int) +
|
||||
dst_width * interp_x.len*sizeof(fixedpoint) +
|
||||
dst_height * interp_y.len * sizeof(fixedpoint) );
|
||||
int* xoffsets = (int*)((uchar*)buf);
|
||||
int* xoffsets = (int*)buf.data();
|
||||
int* yoffsets = xoffsets + dst_width;
|
||||
fixedpoint* xcoeffs = (fixedpoint*)(yoffsets + dst_height);
|
||||
fixedpoint* ycoeffs = xcoeffs + dst_width * interp_x.len;
|
||||
@@ -950,7 +950,7 @@ resizeNN( const Mat& src, Mat& dst, double fx, double fy )
|
||||
{
|
||||
Size ssize = src.size(), dsize = dst.size();
|
||||
AutoBuffer<int> _x_ofs(dsize.width);
|
||||
int* x_ofs = _x_ofs;
|
||||
int* x_ofs = _x_ofs.data();
|
||||
int pix_size = (int)src.elemSize();
|
||||
int pix_size4 = (int)(pix_size / sizeof(int));
|
||||
double ifx = 1./fx, ify = 1./fy;
|
||||
@@ -2226,7 +2226,7 @@ public:
|
||||
for(int k = 0; k < ksize; k++ )
|
||||
{
|
||||
prev_sy[k] = -1;
|
||||
rows[k] = (WT*)_buffer + bufstep*k;
|
||||
rows[k] = _buffer.data() + bufstep*k;
|
||||
}
|
||||
|
||||
const AT* beta = _beta + ksize * range.start;
|
||||
@@ -3039,7 +3039,7 @@ public:
|
||||
AutoBuffer<WT> _buffer(dsize.width*2);
|
||||
const DecimateAlpha* xtab = xtab0;
|
||||
int xtab_size = xtab_size0;
|
||||
WT *buf = _buffer, *sum = buf + dsize.width;
|
||||
WT *buf = _buffer.data(), *sum = buf + dsize.width;
|
||||
int j_start = tabofs[range.start], j_end = tabofs[range.end], j, k, dx, prev_dy = ytab[j_start].di;
|
||||
|
||||
for( dx = 0; dx < dsize.width; dx++ )
|
||||
@@ -3322,7 +3322,7 @@ static bool ocl_resize( InputArray _src, OutputArray _dst, Size dsize,
|
||||
if (depth == CV_8U && ((void)0, 0))
|
||||
{
|
||||
AutoBuffer<uchar> _buffer((dsize.width + dsize.height)*(sizeof(int) + sizeof(short)*2));
|
||||
int* xofs = (int*)(uchar*)_buffer, * yofs = xofs + dsize.width;
|
||||
int* xofs = (int*)_buffer.data(), * yofs = xofs + dsize.width;
|
||||
short* ialpha = (short*)(yofs + dsize.height), * ibeta = ialpha + dsize.width*2;
|
||||
float fxx, fyy;
|
||||
int sx, sy;
|
||||
@@ -3357,7 +3357,7 @@ static bool ocl_resize( InputArray _src, OutputArray _dst, Size dsize,
|
||||
|
||||
int wdepth = std::max(depth, CV_32S), wtype = CV_MAKETYPE(wdepth, cn);
|
||||
UMat coeffs;
|
||||
Mat(1, static_cast<int>(_buffer.size()), CV_8UC1, (uchar *)_buffer).copyTo(coeffs);
|
||||
Mat(1, static_cast<int>(_buffer.size()), CV_8UC1, _buffer.data()).copyTo(coeffs);
|
||||
|
||||
k.create("resizeLN", ocl::imgproc::resize_oclsrc,
|
||||
format("-D INTER_LINEAR_INTEGER -D depth=%d -D T=%s -D T1=%s "
|
||||
@@ -3440,17 +3440,17 @@ static bool ocl_resize( InputArray _src, OutputArray _dst, Size dsize,
|
||||
|
||||
AutoBuffer<int> _xymap_tab(xytab_size), _xyofs_tab(tabofs_size);
|
||||
AutoBuffer<float> _xyalpha_tab(xytab_size);
|
||||
int * xmap_tab = _xymap_tab, * ymap_tab = _xymap_tab + (ssize.width << 1);
|
||||
float * xalpha_tab = _xyalpha_tab, * yalpha_tab = _xyalpha_tab + (ssize.width << 1);
|
||||
int * xofs_tab = _xyofs_tab, * yofs_tab = _xyofs_tab + dsize.width + 1;
|
||||
int * xmap_tab = _xymap_tab.data(), * ymap_tab = _xymap_tab.data() + (ssize.width << 1);
|
||||
float * xalpha_tab = _xyalpha_tab.data(), * yalpha_tab = _xyalpha_tab.data() + (ssize.width << 1);
|
||||
int * xofs_tab = _xyofs_tab.data(), * yofs_tab = _xyofs_tab.data() + dsize.width + 1;
|
||||
|
||||
ocl_computeResizeAreaTabs(ssize.width, dsize.width, inv_fx, xmap_tab, xalpha_tab, xofs_tab);
|
||||
ocl_computeResizeAreaTabs(ssize.height, dsize.height, inv_fy, ymap_tab, yalpha_tab, yofs_tab);
|
||||
|
||||
// loading precomputed arrays to GPU
|
||||
Mat(1, xytab_size, CV_32FC1, (void *)_xyalpha_tab).copyTo(alphaOcl);
|
||||
Mat(1, xytab_size, CV_32SC1, (void *)_xymap_tab).copyTo(mapOcl);
|
||||
Mat(1, tabofs_size, CV_32SC1, (void *)_xyofs_tab).copyTo(tabofsOcl);
|
||||
Mat(1, xytab_size, CV_32FC1, _xyalpha_tab.data()).copyTo(alphaOcl);
|
||||
Mat(1, xytab_size, CV_32SC1, _xymap_tab.data()).copyTo(mapOcl);
|
||||
Mat(1, tabofs_size, CV_32SC1, _xyofs_tab.data()).copyTo(tabofsOcl);
|
||||
}
|
||||
|
||||
ocl::KernelArg srcarg = ocl::KernelArg::ReadOnly(src), dstarg = ocl::KernelArg::WriteOnly(dst);
|
||||
@@ -3856,7 +3856,7 @@ void resize(int src_type,
|
||||
int area = iscale_x*iscale_y;
|
||||
size_t srcstep = src_step / src.elemSize1();
|
||||
AutoBuffer<int> _ofs(area + dsize.width*cn);
|
||||
int* ofs = _ofs;
|
||||
int* ofs = _ofs.data();
|
||||
int* xofs = ofs + area;
|
||||
ResizeAreaFastFunc func = areafast_tab[depth];
|
||||
CV_Assert( func != 0 );
|
||||
@@ -3881,13 +3881,13 @@ void resize(int src_type,
|
||||
CV_Assert( func != 0 && cn <= 4 );
|
||||
|
||||
AutoBuffer<DecimateAlpha> _xytab((src_width + src_height)*2);
|
||||
DecimateAlpha* xtab = _xytab, *ytab = xtab + src_width*2;
|
||||
DecimateAlpha* xtab = _xytab.data(), *ytab = xtab + src_width*2;
|
||||
|
||||
int xtab_size = computeResizeAreaTab(src_width, dsize.width, cn, scale_x, xtab);
|
||||
int ytab_size = computeResizeAreaTab(src_height, dsize.height, 1, scale_y, ytab);
|
||||
|
||||
AutoBuffer<int> _tabofs(dsize.height + 1);
|
||||
int* tabofs = _tabofs;
|
||||
int* tabofs = _tabofs.data();
|
||||
for( k = 0, dy = 0; k < ytab_size; k++ )
|
||||
{
|
||||
if( k == 0 || ytab[k].di != ytab[k-1].di )
|
||||
@@ -3922,7 +3922,7 @@ void resize(int src_type,
|
||||
CV_Assert( func != 0 );
|
||||
|
||||
AutoBuffer<uchar> _buffer((width + dsize.height)*(sizeof(int) + sizeof(float)*ksize));
|
||||
int* xofs = (int*)(uchar*)_buffer;
|
||||
int* xofs = (int*)_buffer.data();
|
||||
int* yofs = xofs + width;
|
||||
float* alpha = (float*)(yofs + dsize.height);
|
||||
short* ialpha = (short*)alpha;
|
||||
|
||||
@@ -96,7 +96,7 @@ static void rotatingCalipers( const Point2f* points, int n, int mode, float* out
|
||||
char buffer[32] = {};
|
||||
int i, k;
|
||||
AutoBuffer<float> abuf(n*3);
|
||||
float* inv_vect_length = abuf;
|
||||
float* inv_vect_length = abuf.data();
|
||||
Point2f* vect = (Point2f*)(inv_vect_length + n);
|
||||
int left = 0, bottom = 0, right = 0, top = 0;
|
||||
int seq[4] = { -1, -1, -1, -1 };
|
||||
|
||||
@@ -318,7 +318,7 @@ cv::RotatedRect cv::fitEllipse( InputArray _points )
|
||||
const Point2f* ptsf = points.ptr<Point2f>();
|
||||
|
||||
AutoBuffer<double> _Ad(n*5), _bd(n);
|
||||
double *Ad = _Ad, *bd = _bd;
|
||||
double *Ad = _Ad.data(), *bd = _bd.data();
|
||||
|
||||
// first fit for parameters A - E
|
||||
Mat A( n, 5, CV_64F, Ad );
|
||||
|
||||
@@ -3614,9 +3614,9 @@ public:
|
||||
virtual void operator() (const Range& range) const CV_OVERRIDE
|
||||
{
|
||||
AutoBuffer<FT> _buf(width*cn*kylen);
|
||||
FT* buf = _buf;
|
||||
FT* buf = _buf.data();
|
||||
AutoBuffer<FT*> _ptrs(kylen*2);
|
||||
FT** ptrs = _ptrs;
|
||||
FT** ptrs = _ptrs.data();
|
||||
|
||||
if (kylen == 1)
|
||||
{
|
||||
|
||||
@@ -216,7 +216,7 @@ void integral_( const T* src, size_t _srcstep, ST* sum, size_t _sumstep,
|
||||
else
|
||||
{
|
||||
AutoBuffer<ST> _buf(width+cn);
|
||||
ST* buf = _buf;
|
||||
ST* buf = _buf.data();
|
||||
ST s;
|
||||
QT sq;
|
||||
for( k = 0; k < cn; k++, src++, sum++, tilted++, buf++ )
|
||||
|
||||
Reference in New Issue
Block a user