mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #11719 from alalek:update_autobuffer_api
This commit is contained in:
@@ -586,7 +586,7 @@ public:
|
||||
float* data_out0_ = output_->ptr<float>();
|
||||
size_t rowbufsz = (size_t)karea*BLK_SIZE_CN*BLK_SIZE;
|
||||
AutoBuffer<float> rowbuf0_(rowbufsz + valign);
|
||||
float* rowbuf0 = alignPtr((float*)rowbuf0_, (int)(valign*sizeof(float)));
|
||||
float* rowbuf0 = alignPtr(rowbuf0_.data(), (int)(valign*sizeof(float)));
|
||||
|
||||
// we clear the buffer once; ultimately, it lets us to avoid
|
||||
// tail processing after running the unrolled/vectorized loop.
|
||||
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
size_t stripeEnd = r.end == nstripes ? total : std::min(r.end*stripeSize, total);
|
||||
size_t wstep = weights->step1();
|
||||
AutoBuffer<float> srcbuf(vecsize_aligned + valign);
|
||||
float* sptr = alignPtr((float*)srcbuf, (int)(valign*sizeof(float)));
|
||||
float* sptr = alignPtr(srcbuf.data(), (int)(valign*sizeof(float)));
|
||||
|
||||
for( k = vecsize; k < vecsize_aligned; k++ )
|
||||
sptr[k] = 0.f;
|
||||
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
int k, channels = channels_, ksize = ksize_;
|
||||
|
||||
AutoBuffer<float> buf_((channels + ksize + 1)*2);
|
||||
float* acc = (float*)buf_;
|
||||
float* acc = buf_.data();
|
||||
float* buf = acc + channels + ksize + 1;
|
||||
for( k = 0; k <= ksize; k++ )
|
||||
buf[-k-1] = buf[channels + k] = 0.f;
|
||||
|
||||
@@ -370,8 +370,8 @@ struct TorchImporter
|
||||
int ndims = readInt();
|
||||
AutoBuffer<int64, 4> sizes(ndims);
|
||||
AutoBuffer<int64, 4> steps(ndims);
|
||||
THFile_readLongRaw(file, sizes, ndims);
|
||||
THFile_readLongRaw(file, steps, ndims);
|
||||
THFile_readLongRaw(file, sizes.data(), ndims);
|
||||
THFile_readLongRaw(file, steps.data(), ndims);
|
||||
long offset = readLong() - 1;
|
||||
|
||||
//read Storage
|
||||
@@ -411,7 +411,7 @@ struct TorchImporter
|
||||
}
|
||||
|
||||
//allocate Blob
|
||||
Mat srcMat(ndims, (int*)isizes, typeTensor , storages[indexStorage].ptr() + offset*CV_ELEM_SIZE(typeTensor), (size_t*)ssteps);
|
||||
Mat srcMat(ndims, isizes.data(), typeTensor , storages[indexStorage].ptr() + offset*CV_ELEM_SIZE(typeTensor), ssteps.data());
|
||||
int dstType = CV_32F;
|
||||
|
||||
Mat blob;
|
||||
|
||||
Reference in New Issue
Block a user