mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
opencv: Use cv::AutoBuffer<>::data()
This commit is contained in:
committed by
Alexander Alekhin
parent
135ea264ef
commit
b09a4a98d4
+11
-11
@@ -401,7 +401,7 @@ JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep,
|
||||
{
|
||||
VBLAS<_Tp> vblas;
|
||||
AutoBuffer<double> Wbuf(n);
|
||||
double* W = Wbuf;
|
||||
double* W = Wbuf.data();
|
||||
int i, j, k, iter, max_iter = std::max(m, 30);
|
||||
_Tp c, s;
|
||||
double sd;
|
||||
@@ -778,7 +778,7 @@ double cv::determinant( InputArray _mat )
|
||||
{
|
||||
size_t bufSize = rows*rows*sizeof(float);
|
||||
AutoBuffer<uchar> buffer(bufSize);
|
||||
Mat a(rows, rows, CV_32F, (uchar*)buffer);
|
||||
Mat a(rows, rows, CV_32F, buffer.data());
|
||||
mat.copyTo(a);
|
||||
|
||||
result = hal::LU32f(a.ptr<float>(), a.step, rows, 0, 0, 0);
|
||||
@@ -801,7 +801,7 @@ double cv::determinant( InputArray _mat )
|
||||
{
|
||||
size_t bufSize = rows*rows*sizeof(double);
|
||||
AutoBuffer<uchar> buffer(bufSize);
|
||||
Mat a(rows, rows, CV_64F, (uchar*)buffer);
|
||||
Mat a(rows, rows, CV_64F, buffer.data());
|
||||
mat.copyTo(a);
|
||||
|
||||
result = hal::LU64f(a.ptr<double>(), a.step, rows, 0, 0, 0);
|
||||
@@ -846,7 +846,7 @@ double cv::invert( InputArray _src, OutputArray _dst, int method )
|
||||
int nm = std::min(m, n);
|
||||
|
||||
AutoBuffer<uchar> _buf((m*nm + nm + nm*n)*esz + sizeof(double));
|
||||
uchar* buf = alignPtr((uchar*)_buf, (int)esz);
|
||||
uchar* buf = alignPtr((uchar*)_buf.data(), (int)esz);
|
||||
Mat u(m, nm, type, buf);
|
||||
Mat w(nm, 1, type, u.ptr() + m*nm*esz);
|
||||
Mat vt(nm, n, type, w.ptr() + nm*esz);
|
||||
@@ -865,7 +865,7 @@ double cv::invert( InputArray _src, OutputArray _dst, int method )
|
||||
if( method == DECOMP_EIG )
|
||||
{
|
||||
AutoBuffer<uchar> _buf((n*n*2 + n)*esz + sizeof(double));
|
||||
uchar* buf = alignPtr((uchar*)_buf, (int)esz);
|
||||
uchar* buf = alignPtr((uchar*)_buf.data(), (int)esz);
|
||||
Mat u(n, n, type, buf);
|
||||
Mat w(n, 1, type, u.ptr() + n*n*esz);
|
||||
Mat vt(n, n, type, w.ptr() + n*esz);
|
||||
@@ -1063,7 +1063,7 @@ double cv::invert( InputArray _src, OutputArray _dst, int method )
|
||||
|
||||
int elem_size = CV_ELEM_SIZE(type);
|
||||
AutoBuffer<uchar> buf(n*n*elem_size);
|
||||
Mat src1(n, n, type, (uchar*)buf);
|
||||
Mat src1(n, n, type, buf.data());
|
||||
src.copyTo(src1);
|
||||
setIdentity(dst);
|
||||
|
||||
@@ -1267,7 +1267,7 @@ bool cv::solve( InputArray _src, InputArray _src2arg, OutputArray _dst, int meth
|
||||
bufsize += n*5*esz + n*vstep + nb*sizeof(double) + 32;
|
||||
|
||||
buffer.allocate(bufsize);
|
||||
uchar* ptr = alignPtr((uchar*)buffer, 16);
|
||||
uchar* ptr = alignPtr(buffer.data(), 16);
|
||||
|
||||
Mat a(m_, n, type, ptr, astep);
|
||||
|
||||
@@ -1445,7 +1445,7 @@ bool cv::eigen( InputArray _src, OutputArray _evals, OutputArray _evects )
|
||||
|
||||
size_t elemSize = src.elemSize(), astep = alignSize(n*elemSize, 16);
|
||||
AutoBuffer<uchar> buf(n*astep + n*5*elemSize + 32);
|
||||
uchar* ptr = alignPtr((uchar*)buf, 16);
|
||||
uchar* ptr = alignPtr(buf.data(), 16);
|
||||
Mat a(n, n, type, ptr, astep), w(n, 1, type, ptr + astep*n);
|
||||
ptr += astep*n + elemSize*n;
|
||||
src.copyTo(a);
|
||||
@@ -1489,7 +1489,7 @@ static void _SVDcompute( InputArray _aarr, OutputArray _w,
|
||||
int urows = full_uv ? m : n;
|
||||
size_t esz = src.elemSize(), astep = alignSize(m*esz, 16), vstep = alignSize(n*esz, 16);
|
||||
AutoBuffer<uchar> _buf(urows*astep + n*vstep + n*esz + 32);
|
||||
uchar* buf = alignPtr((uchar*)_buf, 16);
|
||||
uchar* buf = alignPtr(_buf.data(), 16);
|
||||
Mat temp_a(n, m, type, buf, astep);
|
||||
Mat temp_w(n, 1, type, buf + urows*astep);
|
||||
Mat temp_u(urows, m, type, buf, astep), temp_v;
|
||||
@@ -1568,11 +1568,11 @@ void SVD::backSubst( InputArray _w, InputArray _u, InputArray _vt,
|
||||
if( type == CV_32F )
|
||||
SVBkSb(m, n, w.ptr<float>(), wstep, u.ptr<float>(), u.step, false,
|
||||
vt.ptr<float>(), vt.step, true, rhs.ptr<float>(), rhs.step, nb,
|
||||
dst.ptr<float>(), dst.step, buffer);
|
||||
dst.ptr<float>(), dst.step, buffer.data());
|
||||
else if( type == CV_64F )
|
||||
SVBkSb(m, n, w.ptr<double>(), wstep, u.ptr<double>(), u.step, false,
|
||||
vt.ptr<double>(), vt.step, true, rhs.ptr<double>(), rhs.step, nb,
|
||||
dst.ptr<double>(), dst.step, buffer);
|
||||
dst.ptr<double>(), dst.step, buffer.data());
|
||||
else
|
||||
CV_Error( CV_StsUnsupportedFormat, "" );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user