size_t elements_read = fread( &tmp, sizeof( tmp ), 1, userdata.input );
CV_Assert(elements_read == 1);
- elements_read = fread( vector, sizeof( short ), userdata.vecsize, userdata.input );
+ elements_read = fread(vector.data(), sizeof(short), userdata.vecsize, userdata.input);
CV_Assert(elements_read == (size_t)userdata.vecsize);
if( feof( userdata.input ) || userdata.last++ >= userdata.count )
Mat qangle(gradSize, CV_8U);
AutoBuffer<int> mapbuf(gradSize.width + gradSize.height + 4);
- int* xmap = (int*)mapbuf + 1;
+ int* xmap = mapbuf.data() + 1;
int* ymap = xmap + gradSize.width + 2;
const int borderType = (int)BORDER_REPLICATE;
int width = gradSize.width;
AutoBuffer<float> _dbuf(width*4);
- float* dbuf = _dbuf;
+ float* dbuf = _dbuf.data();
Mat Dx(1, width, CV_32F, dbuf);
Mat Dy(1, width, CV_32F, dbuf + width);
Mat Mag(1, width, CV_32F, dbuf + width*2);
int ci = get_var_type(vi);
CV_Assert( ci < 0 );
- int *src_idx_buf = (int*)(uchar*)inn_buf;
+ int *src_idx_buf = (int*)inn_buf.data();
float *src_val_buf = (float*)(src_idx_buf + sample_count);
int* sample_indices_buf = (int*)(src_val_buf + sample_count);
const int* src_idx = 0;
}
// subsample cv_lables
- const int* src_lbls = get_cv_labels(data_root, (int*)(uchar*)inn_buf);
+ const int* src_lbls = get_cv_labels(data_root, (int*)inn_buf.data());
if (is_buf_16u)
{
unsigned short* udst = (unsigned short*)(buf->data.s + root->buf_idx*get_length_subbuf() +
}
// subsample sample_indices
- const int* sample_idx_src = get_sample_indices(data_root, (int*)(uchar*)inn_buf);
+ const int* sample_idx_src = get_sample_indices(data_root, (int*)inn_buf.data());
if (is_buf_16u)
{
unsigned short* sample_idx_dst = (unsigned short*)(buf->data.s + root->buf_idx*get_length_subbuf() +
void operator()( const Range& range ) const
{
cv::AutoBuffer<float> valCache(sample_count);
- float* valCachePtr = (float*)valCache;
+ float* valCachePtr = valCache.data();
for ( int fi = range.start; fi < range.end; fi++)
{
for( int si = 0; si < sample_count; si++ )
CvMat* buf = data->buf;
size_t length_buf_row = data->get_length_subbuf();
cv::AutoBuffer<uchar> inn_buf(n*(3*sizeof(int)+sizeof(float)));
- int* tempBuf = (int*)(uchar*)inn_buf;
+ int* tempBuf = (int*)inn_buf.data();
bool splitInputData;
complete_node_dir(node);
int inn_buf_size = ((params.boost_type == LOGIT) || (params.boost_type == GENTLE) ? n*sizeof(int) : 0) +
( !tree ? n*sizeof(int) : 0 );
cv::AutoBuffer<uchar> inn_buf(inn_buf_size);
- uchar* cur_inn_buf_pos = (uchar*)inn_buf;
+ uchar* cur_inn_buf_pos = inn_buf.data();
if ( (params.boost_type == LOGIT) || (params.boost_type == GENTLE) )
{
step = CV_IS_MAT_CONT(data->responses_copy->type) ?
// store the responses for the corresponding training samples
double* weak_eval = ensemble->get_weak_response()->data.db;
cv::AutoBuffer<int> inn_buf(node->sample_count);
- const int* labels = data->get_cv_labels( node, (int*)inn_buf );
+ const int* labels = data->get_cv_labels(node, inn_buf.data());
int i, count = node->sample_count;
double value = node->value;
if( data->get_var_type(vi) >= 0 ) // split on categorical var
{
cv::AutoBuffer<int> inn_buf(n);
- const int* cat_labels = data->get_cat_var_data( node, vi, (int*)inn_buf );
+ const int* cat_labels = data->get_cat_var_data(node, vi, inn_buf.data());
const int* subset = node->split->subset;
double sum = 0, sum_abs = 0;
else // split on ordered var
{
cv::AutoBuffer<uchar> inn_buf(2*n*sizeof(int)+n*sizeof(float));
- float* values_buf = (float*)(uchar*)inn_buf;
+ float* values_buf = (float*)inn_buf.data();
int* sorted_indices_buf = (int*)(values_buf + n);
int* sample_indices_buf = sorted_indices_buf + n;
const float* values = 0;
cv::AutoBuffer<uchar> inn_buf;
if( !_ext_buf )
inn_buf.allocate(n*(3*sizeof(int)+sizeof(float)));
- uchar* ext_buf = _ext_buf ? _ext_buf : (uchar*)inn_buf;
+ uchar* ext_buf = _ext_buf ? _ext_buf : inn_buf.data();
float* values_buf = (float*)ext_buf;
int* sorted_indices_buf = (int*)(values_buf + n);
int* sample_indices_buf = sorted_indices_buf + n;
cv::AutoBuffer<uchar> inn_buf((2*mi+3)*sizeof(double) + mi*sizeof(double*));
if( !_ext_buf)
inn_buf.allocate( base_size + 2*n*sizeof(int) );
- uchar* base_buf = (uchar*)inn_buf;
+ uchar* base_buf = inn_buf.data();
uchar* ext_buf = _ext_buf ? _ext_buf : base_buf + base_size;
int* cat_labels_buf = (int*)ext_buf;
cv::AutoBuffer<uchar> inn_buf;
if( !_ext_buf )
inn_buf.allocate(2*n*(sizeof(int)+sizeof(float)));
- uchar* ext_buf = _ext_buf ? _ext_buf : (uchar*)inn_buf;
+ uchar* ext_buf = _ext_buf ? _ext_buf : inn_buf.data();
float* values_buf = (float*)ext_buf;
int* indices_buf = (int*)(values_buf + n);
cv::AutoBuffer<uchar> inn_buf(base_size);
if( !_ext_buf )
inn_buf.allocate(base_size + n*(2*sizeof(int) + sizeof(float)));
- uchar* base_buf = (uchar*)inn_buf;
+ uchar* base_buf = inn_buf.data();
uchar* ext_buf = _ext_buf ? _ext_buf : base_buf + base_size;
int* cat_labels_buf = (int*)ext_buf;
cv::AutoBuffer<uchar> inn_buf;
if( !_ext_buf )
inn_buf.allocate(n*(2*sizeof(int)+sizeof(float)));
- uchar* ext_buf = _ext_buf ? _ext_buf : (uchar*)inn_buf;
+ uchar* ext_buf = _ext_buf ? _ext_buf : inn_buf.data();
float* values_buf = (float*)ext_buf;
int* indices_buf = (int*)(values_buf + n);
int* sample_indices_buf = indices_buf + n;
cv::AutoBuffer<uchar> inn_buf(base_size);
if( !_ext_buf )
inn_buf.allocate(base_size + n*sizeof(int));
- uchar* ext_buf = _ext_buf ? _ext_buf : (uchar*)inn_buf;
+ uchar* ext_buf = _ext_buf ? _ext_buf : inn_buf.data();
int* cat_labels_buf = (int*)ext_buf;
const int* cat_labels = data->get_cat_var_data(node, vi, cat_labels_buf);
int i, n = node->sample_count;
const double* weights = ensemble->get_weights()->data.db;
cv::AutoBuffer<uchar> inn_buf(n*(sizeof(int) + ( data->is_classifier ? sizeof(int) : sizeof(int) + sizeof(float))));
- int* labels_buf = (int*)(uchar*)inn_buf;
+ int* labels_buf = (int*)inn_buf.data();
const int* labels = data->get_cv_labels(node, labels_buf);
double* subtree_weights = ensemble->get_subtree_weights()->data.db;
double rcw[2] = {0,0};
_buf_size += data->get_length_subbuf()*(sizeof(float)+sizeof(uchar));
}
inn_buf.allocate(_buf_size);
- uchar* cur_buf_pos = (uchar*)inn_buf;
+ uchar* cur_buf_pos = inn_buf.data();
if ( (params.boost_type == LOGIT) || (params.boost_type == GENTLE) )
{
if( ci >= 0 || vi >= var_count )
{
int num_valid = 0;
- const int* src = CvDTreeTrainData::get_cat_var_data( data_root, vi, (int*)(uchar*)inn_buf );
+ const int* src = CvDTreeTrainData::get_cat_var_data(data_root, vi, (int*)inn_buf.data());
if (is_buf_16u)
{
}
else
{
- int *src_idx_buf = (int*)(uchar*)inn_buf;
+ int *src_idx_buf = (int*)inn_buf.data();
float *src_val_buf = (float*)(src_idx_buf + sample_count);
int* sample_indices_buf = (int*)(src_val_buf + sample_count);
const int* src_idx = 0;
}
}
// sample indices subsampling
- const int* sample_idx_src = get_sample_indices(data_root, (int*)(uchar*)inn_buf);
+ const int* sample_idx_src = get_sample_indices(data_root, (int*)inn_buf.data());
if (is_buf_16u)
{
unsigned short* sample_idx_dst = (unsigned short*)(buf->data.s + root->buf_idx*get_length_subbuf() +
{
float* dst = values + vi;
uchar* m = missing ? missing + vi : 0;
- const int* src = get_cat_var_data(data_root, vi, (int*)(uchar*)inn_buf);
+ const int* src = get_cat_var_data(data_root, vi, (int*)inn_buf.data());
for( i = 0; i < count; i++, dst += var_count )
{
float* dst = values + vi;
uchar* m = missing ? missing + vi : 0;
int count1 = data_root->get_num_valid(vi);
- float *src_val_buf = (float*)(uchar*)inn_buf;
+ float *src_val_buf = (float*)inn_buf.data();
int* src_idx_buf = (int*)(src_val_buf + sample_count);
int* sample_indices_buf = src_idx_buf + sample_count;
const float *src_val = 0;
{
if( is_classifier )
{
- const int* src = get_class_labels(data_root, (int*)(uchar*)inn_buf);
+ const int* src = get_class_labels(data_root, (int*)inn_buf.data());
for( i = 0; i < count; i++ )
{
int idx = sidx ? sidx[i] : i;
}
else
{
- float* val_buf = (float*)(uchar*)inn_buf;
+ float* val_buf = (float*)inn_buf.data();
int* sample_idx_buf = (int*)(val_buf + sample_count);
const float* _values = get_ord_responses(data_root, val_buf, sample_idx_buf);
for( i = 0; i < count; i++ )
if( data->get_var_type(vi) >= 0 ) // split on categorical var
{
cv::AutoBuffer<int> inn_buf(n*(!data->have_priors ? 1 : 2));
- int* labels_buf = (int*)inn_buf;
+ int* labels_buf = inn_buf.data();
const int* labels = data->get_cat_var_data( node, vi, labels_buf );
const int* subset = node->split->subset;
if( !data->have_priors )
int split_point = node->split->ord.split_point;
int n1 = node->get_num_valid(vi);
cv::AutoBuffer<uchar> inn_buf(n*(sizeof(int)*(data->have_priors ? 3 : 2) + sizeof(float)));
- float* val_buf = (float*)(uchar*)inn_buf;
+ float* val_buf = (float*)inn_buf.data();
int* sorted_buf = (int*)(val_buf + n);
int* sample_idx_buf = sorted_buf + n;
const float* val = 0;
if( data->is_classifier )
{
if( ci >= 0 )
- res = tree->find_split_cat_class( node, vi, bestSplit->quality, split, (uchar*)inn_buf );
+ res = tree->find_split_cat_class( node, vi, bestSplit->quality, split, inn_buf.data() );
else
- res = tree->find_split_ord_class( node, vi, bestSplit->quality, split, (uchar*)inn_buf );
+ res = tree->find_split_ord_class( node, vi, bestSplit->quality, split, inn_buf.data() );
}
else
{
if( ci >= 0 )
- res = tree->find_split_cat_reg( node, vi, bestSplit->quality, split, (uchar*)inn_buf );
+ res = tree->find_split_cat_reg( node, vi, bestSplit->quality, split, inn_buf.data() );
else
- res = tree->find_split_ord_reg( node, vi, bestSplit->quality, split, (uchar*)inn_buf );
+ res = tree->find_split_ord_reg( node, vi, bestSplit->quality, split, inn_buf.data() );
}
if( res && bestSplit->quality < split->quality )
cv::AutoBuffer<uchar> inn_buf(base_size);
if( !_ext_buf )
inn_buf.allocate(base_size + n*(3*sizeof(int)+sizeof(float)));
- uchar* base_buf = (uchar*)inn_buf;
+ uchar* base_buf = inn_buf.data();
uchar* ext_buf = _ext_buf ? _ext_buf : base_buf + base_size;
float* values_buf = (float*)ext_buf;
int* sorted_indices_buf = (int*)(values_buf + n);
int iters = 0, max_iters = 100;
int i, j, idx;
cv::AutoBuffer<double> buf(n + k);
- double *v_weights = buf, *c_weights = buf + n;
+ double *v_weights = buf.data(), *c_weights = buf.data() + n;
bool modified = true;
RNG* r = data->rng;
cv::AutoBuffer<uchar> inn_buf(base_size);
if( !_ext_buf )
inn_buf.allocate(base_size + 2*n*sizeof(int));
- uchar* base_buf = (uchar*)inn_buf;
+ uchar* base_buf = inn_buf.data();
uchar* ext_buf = _ext_buf ? _ext_buf : base_buf + base_size;
int* lc = (int*)base_buf;
cv::AutoBuffer<uchar> inn_buf;
if( !_ext_buf )
inn_buf.allocate(2*n*(sizeof(int) + sizeof(float)));
- uchar* ext_buf = _ext_buf ? _ext_buf : (uchar*)inn_buf;
+ uchar* ext_buf = _ext_buf ? _ext_buf : inn_buf.data();
float* values_buf = (float*)ext_buf;
int* sorted_indices_buf = (int*)(values_buf + n);
int* sample_indices_buf = sorted_indices_buf + n;
cv::AutoBuffer<uchar> inn_buf(base_size);
if( !_ext_buf )
inn_buf.allocate(base_size + n*(2*sizeof(int) + sizeof(float)));
- uchar* base_buf = (uchar*)inn_buf;
+ uchar* base_buf = inn_buf.data();
uchar* ext_buf = _ext_buf ? _ext_buf : base_buf + base_size;
int* labels_buf = (int*)ext_buf;
const int* labels = data->get_cat_var_data(node, vi, labels_buf);
cv::AutoBuffer<uchar> inn_buf;
if( !_ext_buf )
inn_buf.allocate( n*(sizeof(int)*(data->have_priors ? 3 : 2) + sizeof(float)) );
- uchar* ext_buf = _ext_buf ? _ext_buf : (uchar*)inn_buf;
+ uchar* ext_buf = _ext_buf ? _ext_buf : inn_buf.data();
float* values_buf = (float*)ext_buf;
int* sorted_indices_buf = (int*)(values_buf + n);
int* sample_indices_buf = sorted_indices_buf + n;
cv::AutoBuffer<uchar> inn_buf(base_size);
if( !_ext_buf )
inn_buf.allocate(base_size + n*(sizeof(int) + (data->have_priors ? sizeof(int) : 0)));
- uchar* base_buf = (uchar*)inn_buf;
+ uchar* base_buf = inn_buf.data();
uchar* ext_buf = _ext_buf ? _ext_buf : base_buf + base_size;
int* labels_buf = (int*)ext_buf;
int base_size = data->is_classifier ? m*cv_n*sizeof(int) : 2*cv_n*sizeof(double)+cv_n*sizeof(int);
int ext_size = n*(sizeof(int) + (data->is_classifier ? sizeof(int) : sizeof(int)+sizeof(float)));
cv::AutoBuffer<uchar> inn_buf(base_size + ext_size);
- uchar* base_buf = (uchar*)inn_buf;
+ uchar* base_buf = inn_buf.data();
uchar* ext_buf = base_buf + base_size;
int* cv_labels_buf = (int*)ext_buf;
if( data->get_var_type(vi) >= 0 ) // split on categorical var
{
- int* labels_buf = (int*)(uchar*)inn_buf;
+ int* labels_buf = (int*)inn_buf.data();
const int* labels = data->get_cat_var_data(node, vi, labels_buf);
const int* subset = split->subset;
}
else // split on ordered var
{
- float* values_buf = (float*)(uchar*)inn_buf;
+ float* values_buf = (float*)inn_buf.data();
int* sorted_indices_buf = (int*)(values_buf + n);
int* sample_indices_buf = sorted_indices_buf + n;
const float* values = 0;
CvMat* buf = data->buf;
size_t length_buf_row = data->get_length_subbuf();
cv::AutoBuffer<uchar> inn_buf(n*(3*sizeof(int) + sizeof(float)));
- int* temp_buf = (int*)(uchar*)inn_buf;
+ int* temp_buf = (int*)inn_buf.data();
complete_node_dir(node);
// get bounding rectangle
CvPoint2D32f temp = centers[skip]; // temporarily make index 'skip' the same as
centers[skip] = center; // pattern center (so it is not counted for convex hull)
- CvMat pointMat = cvMat(1, quad_count, CV_32FC2, centers);
+ CvMat pointMat = cvMat(1, quad_count, CV_32FC2, centers.data());
CvSeq *hull = cvConvexHull2( &pointMat, temp_storage, CV_CLOCKWISE, 1 );
centers[skip] = temp;
double hull_area = fabs(cvContourArea(hull, CV_WHOLE_SEQ));
int maxAttempts=1000 ) const
{
cv::AutoBuffer<int> _idx(modelPoints);
- int* idx = _idx;
+ int* idx = _idx.data();
int i = 0, j, k, iters = 0;
int d1 = m1.channels() > 1 ? m1.channels() : m1.cols;
int d2 = m2.channels() > 1 ? m2.channels() : m2.cols;
int minD = minDisparity, maxD = minDisparity + numberOfDisparities;
int x, minX1 = std::max(maxD, 0), maxX1 = cols + std::min(minD, 0);
AutoBuffer<int> _disp2buf(cols*2);
- int* disp2buf = _disp2buf;
+ int* disp2buf = _disp2buf.data();
int* disp2cost = disp2buf + cols;
const int DISP_SHIFT = 4, DISP_SCALE = 1 << DISP_SHIFT;
int INVALID_DISP = minD - 1, INVALID_DISP_SCALED = INVALID_DISP*DISP_SCALE;
#ifdef __OPENCV_BUILD
# define DISABLE_OPENCV_24_COMPATIBILITY
+# define OPENCV_DISABLE_DEPRECATED_COMPATIBILITY
#endif
#ifdef CVAPI_EXPORTS
{
blocksize = std::min(blocksize, blocksize0);
_buf.allocate(blocksize*esz);
- maskbuf = _buf;
+ maskbuf = _buf.data();
}
for( size_t i = 0; i < it.nplanes; i++, ++it )
size_t total = it.size, blocksize = std::min(total, blocksize0);
_buf.allocate(blocksize*(haveMask ? 2 : 1)*esz + 32);
- scbuf = _buf;
+ scbuf = _buf.data();
maskbuf = alignPtr(scbuf + blocksize*esz, 16);
convertAndUnrollScalar( src2, src1.type(), scbuf, blocksize);
blocksize = std::min(blocksize, blocksize0);
_buf.allocate(bufesz*blocksize + 64);
- buf = _buf;
+ buf = _buf.data();
if( cvtsrc1 )
buf1 = buf, buf = alignPtr(buf + blocksize*wsz, 16);
if( cvtsrc2 )
size_t total = it.size, blocksize = std::min(total, blocksize0);
_buf.allocate(bufesz*blocksize + 64);
- buf = _buf;
+ buf = _buf.data();
if( cvtsrc1 )
buf1 = buf, buf = alignPtr(buf + blocksize*wsz, 16);
buf2 = buf; buf = alignPtr(buf + blocksize*wsz, 16);
size_t total = it.size, blocksize = std::min(total, blocksize0);
AutoBuffer<uchar> _buf(blocksize*esz);
- uchar *buf = _buf;
+ uchar *buf = _buf.data();
if( depth1 > CV_32S )
convertAndUnrollScalar( src2, depth1, buf, blocksize );
size_t blocksize = 36;
AutoBuffer<uchar> _buf(blocksize*(((int)lbScalar + (int)ubScalar)*esz + cn) + 2*cn*sizeof(int) + 128);
- uchar *buf = alignPtr(_buf + blocksize*cn, 16);
+ uchar *buf = alignPtr(_buf.data() + blocksize*cn, 16);
if( ldepth != sdepth && sdepth < CV_32S )
{
size_t total = it.size, blocksize = std::min(total, blocksize0);
AutoBuffer<uchar> _buf(blocksize*(((int)lbScalar + (int)ubScalar)*esz + cn) + 2*cn*sizeof(int) + 128);
- uchar *buf = _buf, *mbuf = buf, *lbuf = 0, *ubuf = 0;
+ uchar *buf = _buf.data(), *mbuf = buf, *lbuf = 0, *ubuf = 0;
buf = alignPtr(buf + blocksize*cn, 16);
if( lbScalar && ubScalar )
void operator()(const Range& range) const CV_OVERRIDE
{
AutoBuffer<int> buf(src2->rows);
- int* bufptr = buf;
+ int* bufptr = buf.data();
for( int i = range.start; i < range.end; i++ )
{
int depth = dst[0].depth();
AutoBuffer<uchar> buf((nsrcs + ndsts + 1)*(sizeof(Mat*) + sizeof(uchar*)) + npairs*(sizeof(uchar*)*2 + sizeof(int)*6));
- const Mat** arrays = (const Mat**)(uchar*)buf;
+ const Mat** arrays = (const Mat**)(uchar*)buf.data();
uchar** ptrs = (uchar**)(arrays + nsrcs + ndsts);
const uchar** srcs = (const uchar**)(ptrs + nsrcs + ndsts + 1);
uchar** dsts = (uchar**)(srcs + npairs);
CV_Assert(nsrc > 0 && ndst > 0);
cv::AutoBuffer<Mat> _buf(nsrc + ndst);
- Mat* buf = _buf;
+ Mat* buf = _buf.data();
for( i = 0; i < nsrc; i++ )
buf[i] = src.getMat(src_is_mat ? -1 : i);
for( i = 0; i < ndst; i++ )
CV_Assert(fromTo.size()%2 == 0 && nsrc > 0 && ndst > 0);
cv::AutoBuffer<Mat> _buf(nsrc + ndst);
- Mat* buf = _buf;
+ Mat* buf = _buf.data();
for( i = 0; i < nsrc; i++ )
buf[i] = src.getMat(src_is_mat ? -1 : i);
for( i = 0; i < ndst; i++ )
double eps = getGradientEps();
int i, n = getDims();
AutoBuffer<double> x_buf(n);
- double* x_ = x_buf;
+ double* x_ = x_buf.data();
for( i = 0; i < n; i++ )
x_[i] = x[i];
for( i = 0; i < n; i++ )
int blockSize0 = std::min(totalsz, (int)((BLOCK_SIZE + esz-1)/esz));
blockSize0 -= blockSize0 % mcn; // must be divisible without remainder for unrolling and advancing
AutoBuffer<uchar> _scbuf(blockSize0*esz + 32);
- uchar* scbuf = alignPtr((uchar*)_scbuf, (int)sizeof(double));
+ uchar* scbuf = alignPtr((uchar*)_scbuf.data(), (int)sizeof(double));
convertAndUnrollScalar( value, type(), scbuf, blockSize0/mcn );
for( size_t i = 0; i < it.nplanes; i++, ++it )
{
int i, j, limit = (int)(((size.width + 1)/2)*esz);
AutoBuffer<int> _tab(size.width*esz);
- int* tab = _tab;
+ int* tab = _tab.data();
for( i = 0; i < size.width; i++ )
for( size_t k = 0; k < esz; k++ )
}
cv::AutoBuffer<int> _tab((dstroi.width - srcroi.width)*cn);
- int* tab = _tab;
+ int* tab = _tab.data();
int right = dstroi.width - srcroi.width - left;
int bottom = dstroi.height - srcroi.height - top;
{
int i, j;
cv::AutoBuffer<uchar> _constBuf(dstroi.width*cn);
- uchar* constBuf = _constBuf;
+ uchar* constBuf = _constBuf.data();
int right = dstroi.width - srcroi.width - left;
int bottom = dstroi.height - srcroi.height - top;
CV_Assert( value[0] == value[1] && value[0] == value[2] && value[0] == value[3] );
cn1 = 1;
}
- scalarToRawData(value, buf, CV_MAKETYPE(src.depth(), cn1), cn);
+ scalarToRawData(value, buf.data(), CV_MAKETYPE(src.depth(), cn1), cn);
copyMakeConstBorder_8u( src.ptr(), src.step, src.size(),
dst.ptr(), dst.step, dst.size(),
- top, left, (int)src.elemSize(), (uchar*)(double*)buf );
+ top, left, (int)src.elemSize(), (uchar*)buf.data() );
}
}
int p, q, factor2 = (factor - 1)/2;
int d, dd, dw_f = c.tab_size/factor;
AutoBuffer<Complex<T> > buf(factor2 * 2);
- Complex<T>* a = buf;
+ Complex<T>* a = buf.data();
Complex<T>* b = a + factor2;
for( i = 0; i < c.n; i += n )
uchar* dptr = dptr0;
if( needBufferA )
- dptr = tmp_bufA;
+ dptr = tmp_bufA.data();
contextA->apply(sptr, dptr);
const uchar* sptr0 = src_data;
uchar* dptr0 = dst_data;
- dbuf0 = buf0, dbuf1 = buf1;
+ dbuf0 = buf0.data(), dbuf1 = buf1.data();
if( needBufferB )
{
- dbuf1 = tmp_bufB;
- dbuf0 = buf1;
+ dbuf1 = tmp_bufB.data();
+ dbuf0 = buf1.data();
}
if( real_transform )
b = (count+1)/2;
if( !inv )
{
- memset( buf0, 0, len*complex_elem_size );
- CopyColumn( sptr0, src_step, buf0, complex_elem_size, len, elem_size );
+ memset( buf0.data(), 0, len*complex_elem_size );
+ CopyColumn( sptr0, src_step, buf0.data(), complex_elem_size, len, elem_size );
sptr0 += stage_dst_channels*elem_size;
if( even )
{
- memset( buf1, 0, len*complex_elem_size );
+ memset( buf1.data(), 0, len*complex_elem_size );
CopyColumn( sptr0 + (count-2)*elem_size, src_step,
- buf1, complex_elem_size, len, elem_size );
+ buf1.data(), complex_elem_size, len, elem_size );
}
}
else if( stage_src_channels == 1 )
{
- CopyColumn( sptr0, src_step, buf0, elem_size, len, elem_size );
- ExpandCCS( buf0, len, elem_size );
+ CopyColumn( sptr0, src_step, buf0.data(), elem_size, len, elem_size );
+ ExpandCCS( buf0.data(), len, elem_size );
if( even )
{
CopyColumn( sptr0 + (count-1)*elem_size, src_step,
- buf1, elem_size, len, elem_size );
- ExpandCCS( buf1, len, elem_size );
+ buf1.data(), elem_size, len, elem_size );
+ ExpandCCS( buf1.data(), len, elem_size );
}
sptr0 += elem_size;
}
else
{
- CopyColumn( sptr0, src_step, buf0, complex_elem_size, len, complex_elem_size );
+ CopyColumn( sptr0, src_step, buf0.data(), complex_elem_size, len, complex_elem_size );
if( even )
{
CopyColumn( sptr0 + b*complex_elem_size, src_step,
- buf1, complex_elem_size, len, complex_elem_size );
+ buf1.data(), complex_elem_size, len, complex_elem_size );
}
sptr0 += complex_elem_size;
}
if( even )
- contextB->apply(buf1, dbuf1);
- contextB->apply(buf0, dbuf0);
+ contextB->apply(buf1.data(), dbuf1);
+ contextB->apply(buf0.data(), dbuf0);
if( stage_dst_channels == 1 )
{
{
if( i+1 < b )
{
- CopyFrom2Columns( sptr0, src_step, buf0, buf1, len, complex_elem_size );
- contextB->apply(buf1, dbuf1);
+ CopyFrom2Columns( sptr0, src_step, buf0.data(), buf1.data(), len, complex_elem_size );
+ contextB->apply(buf1.data(), dbuf1);
}
else
- CopyColumn( sptr0, src_step, buf0, complex_elem_size, len, complex_elem_size );
+ CopyColumn( sptr0, src_step, buf0.data(), complex_elem_size, len, complex_elem_size );
- contextB->apply(buf0, dbuf0);
+ contextB->apply(buf0.data(), dbuf0);
if( i+1 < b )
CopyTo2Columns( dbuf0, dbuf1, dptr0, dst_step, len, complex_elem_size );
if (len != prev_len || (!inplace_transform && opt.isInverse && real_transform))
{
wave_buf.allocate(opt.n*complex_elem_size);
- opt.wave = wave_buf;
+ opt.wave = wave_buf.data();
itab_buf.allocate(opt.n);
- opt.itab = itab_buf;
+ opt.itab = itab_buf.data();
DFTInit( opt.n, opt.nf, opt.factors, opt.itab, complex_elem_size,
opt.wave, stage == 0 && opt.isInverse && real_transform );
}
bool inplace_transform = opt.factors[0] == opt.factors[opt.nf-1];
wave_buf.allocate(len*complex_elem_size);
- opt.wave = wave_buf;
+ opt.wave = wave_buf.data();
itab_buf.allocate(len);
- opt.itab = itab_buf;
+ opt.itab = itab_buf.data();
DFTInit( len, opt.nf, opt.factors, opt.itab, complex_elem_size, opt.wave, isInverse );
dct_wave.allocate((len/2 + 1)*complex_elem_size);
src_buf.allocate(len*elem_size);
- src_dft_buf = src_buf;
+ src_dft_buf = src_buf.data();
if(!inplace_transform)
{
dst_buf.allocate(len*elem_size);
- dst_dft_buf = dst_buf;
+ dst_dft_buf = dst_buf.data();
}
else
{
- dst_dft_buf = src_buf;
+ dst_dft_buf = src_buf.data();
}
- DCTInit( len, complex_elem_size, dct_wave, isInverse);
+ DCTInit( len, complex_elem_size, dct_wave.data(), isInverse);
prev_len = len;
}
// otherwise reuse the tables calculated on the previous stage
for(unsigned i = 0; i < static_cast<unsigned>(count); i++ )
{
dct_func( opt, sptr + i*sstep0, sstep1, src_dft_buf, dst_dft_buf,
- dptr + i*dstep0, dstep1, dct_wave);
+ dptr + i*dstep0, dstep1, dct_wave.data());
}
src = dst;
src_step = dst_step;
else
{
for (int k = 0; k < K; k++)
- generateRandomCenter(dims, box, centers.ptr<float>(k), rng);
+ generateRandomCenter(dims, box.data(), centers.ptr<float>(k), rng);
}
}
else
if (isLastIter)
{
// don't re-assign labels to avoid creation of empty clusters
- parallel_for_(Range(0, N), KMeansDistanceComputer<true>(dists, labels, data, centers), (double)divUp((size_t)(dims * N), CV_KMEANS_PARALLEL_GRANULARITY));
+ parallel_for_(Range(0, N), KMeansDistanceComputer<true>(dists.data(), labels, data, centers), (double)divUp((size_t)(dims * N), CV_KMEANS_PARALLEL_GRANULARITY));
compactness = sum(Mat(Size(N, 1), CV_64F, &dists[0]))[0];
break;
}
else
{
// assign labels
- parallel_for_(Range(0, N), KMeansDistanceComputer<false>(dists, labels, data, centers), (double)divUp((size_t)(dims * N * K), CV_KMEANS_PARALLEL_GRANULARITY));
+ parallel_for_(Range(0, N), KMeansDistanceComputer<false>(dists.data(), labels, data, centers), (double)divUp((size_t)(dims * N * K), CV_KMEANS_PARALLEL_GRANULARITY));
}
}
{
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;
{
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);
{
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);
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);
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);
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);
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);
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);
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;
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, "" );
}
if( depth == CV_64F )
{
_buf.allocate(blockSize*2);
- buf[0] = _buf;
+ buf[0] = _buf.data();
buf[1] = buf[0] + blockSize;
}
if( src.ptr() == dst.ptr() )
{
buf.allocate(blockSize*esz1);
- fbuf = (float*)(uchar*)buf;
- dbuf = (double*)(uchar*)buf;
+ fbuf = (float*)buf.data();
+ dbuf = (double*)buf.data();
}
for( size_t i = 0; i < it.nplanes; i++, ++it )
Mat roots0 = _roots0.getMat();
AutoBuffer<C> buf(n*2+2);
- C *coeffs = buf, *roots = coeffs + n + 1;
+ C *coeffs = buf.data(), *roots = coeffs + n + 1;
Mat coeffs1(coeffs0.size(), CV_MAKETYPE(CV_64F, coeffs0.channels()), coeffs0.channels() == 2 ? coeffs : roots);
coeffs0.convertTo(coeffs1, coeffs1.type());
if( coeffs0.channels() == 1 )
if( a_step > 1 && n > 1 )
{
_a_buf.allocate(n);
- a_buf = _a_buf;
+ a_buf = _a_buf.data();
}
}
if( a_step > 1 && a_size.height > 1 )
{
_a_buf.allocate(drows);
- a_buf = _a_buf;
+ a_buf = _a_buf.data();
for( k = 0; k < drows; k++ )
a_buf[k] = a_data[a_step*k];
a_data = a_buf;
if( b_step > 1 )
{
_b_buf.allocate(d_size.width);
- b_buf = _b_buf;
+ b_buf = _b_buf.data();
for( j = 0; j < d_size.width; j++ )
b_buf[j] = b_data[j*b_step];
b_data = b_buf;
else
{
cv::AutoBuffer<WT> _d_buf(m);
- WT* d_buf = _d_buf;
+ WT* d_buf = _d_buf.data();
for( i = 0; i < drows; i++, _a_data += a_step0, _c_data += c_step0, d_data += d_step )
{
CV_SWAP( a_step0, a_step1, t_step );
n = a_size.height;
_a_buf.allocate(n);
- a_buf = _a_buf;
+ a_buf = _a_buf.data();
}
if( flags & GEMM_2_T )
}
buf.allocate(d_buf_size + b_buf_size + a_buf_size);
- d_buf = (uchar*)buf;
+ d_buf = buf.data();
b_buf = d_buf + d_buf_size;
if( is_a_t )
if( !m.isContinuous() || m.type() != mtype || m.cols != scn + 1 )
{
_mbuf.allocate(dcn*(scn+1));
- mbuf = (double*)_mbuf;
+ mbuf = _mbuf.data();
Mat tmp(dcn, scn+1, mtype, mbuf);
memset(tmp.ptr(), 0, tmp.total()*tmp.elemSize());
if( m.cols == scn+1 )
const int mtype = CV_64F;
AutoBuffer<double> _mbuf;
- double* mbuf = _mbuf;
+ double* mbuf = m.ptr<double>();
if( !m.isContinuous() || m.type() != mtype )
{
_mbuf.allocate((dcn+1)*(scn+1));
- Mat tmp(dcn+1, scn+1, mtype, (double*)_mbuf);
+ mbuf = _mbuf.data();
+ Mat tmp(dcn+1, scn+1, mtype, mbuf);
m.convertTo(tmp, mtype);
m = tmp;
}
- else
- mbuf = m.ptr<double>();
TransformFunc func = depth == CV_32F ?
(TransformFunc)perspectiveTransform_32f :
const float* src2 = v2.ptr<float>();
size_t step1 = v1.step/sizeof(src1[0]);
size_t step2 = v2.step/sizeof(src2[0]);
- double* diff = buf;
+ double* diff = buf.data();
const float* mat = icovar.ptr<float>();
size_t matstep = icovar.step/sizeof(mat[0]);
diff[i] = src1[i] - src2[i];
}
- diff = buf;
+ diff = buf.data();
for( i = 0; i < len; i++, mat += matstep )
{
double row_sum = 0;
const double* src2 = v2.ptr<double>();
size_t step1 = v1.step/sizeof(src1[0]);
size_t step2 = v2.step/sizeof(src2[0]);
- double* diff = buf;
+ double* diff = buf.data();
const double* mat = icovar.ptr<double>();
size_t matstep = icovar.step/sizeof(mat[0]);
diff[i] = src1[i] - src2[i];
}
- diff = buf;
+ diff = buf.data();
for( i = 0; i < len; i++, mat += matstep )
{
double row_sum = 0;
buf_size *= 5;
}
buf.allocate(buf_size);
- col_buf = (dT*)(uchar*)buf;
+ col_buf = (dT*)buf.data();
if( delta && delta_cols < size.width )
{
dT delta_buf[4];
int delta_shift = delta_cols == size.width ? 4 : 0;
AutoBuffer<uchar> buf(size.width*sizeof(dT));
- dT* row_buf = (dT*)(uchar*)buf;
+ dT* row_buf = (dT*)buf.data();
for( i = 0; i < size.height; i++, tdst += dststep )
{
rs[1] = _colRange;
for( int i = 2; i < m.dims; i++ )
rs[i] = Range::all();
- *this = m(rs);
+ *this = m(rs.data());
return;
}
Mat hdr = *this;
hdr.flags = (hdr.flags & ~CV_MAT_CN_MASK) | ((_cn-1) << CV_CN_SHIFT);
- setSize(hdr, _newndims, (int*)newsz_buf, NULL, true);
+ setSize(hdr, _newndims, newsz_buf.data(), NULL, true);
return hdr;
}
if( abuf )
{
abuf->allocate(((size_t)total*esz + sizeof(double)-1)/sizeof(double));
- double* bufdata = *abuf;
+ double* bufdata = abuf->data();
cvCvtSeqToArray(seq, bufdata, CV_WHOLE_SEQ);
return Mat(total, 1, type, bufdata);
}
cv::AutoBuffer<_Tp> buffer;
size_t buf_size = m ? m + n : hFactors != NULL;
buffer.allocate(buf_size);
- _Tp* vl = buffer;
+ _Tp* vl = buffer.data();
if (hFactors == NULL)
hFactors = vl + m;
Size size = srcmat.size();
size.width *= srcmat.channels();
AutoBuffer<WT> buffer(size.width);
- WT* buf = buffer;
+ WT* buf = buffer.data();
ST* dst = dstmat.ptr<ST>();
const T* src = srcmat.ptr<T>();
size_t srcstep = srcmat.step/sizeof(src[0]);
template<typename T> static void sort_( const Mat& src, Mat& dst, int flags )
{
AutoBuffer<T> buf;
- T* bptr;
int n, len;
bool sortRows = (flags & 1) == CV_SORT_EVERY_ROW;
bool inplace = src.data == dst.data;
n = src.cols, len = src.rows;
buf.allocate(len);
}
- bptr = (T*)buf;
+ T* bptr = buf.data();
for( int i = 0; i < n; i++ )
{
for(int i = 0; i < dst.rows; i++)
{
- if(CV_INSTRUMENT_FUN_IPP(ippsSortRadix_I, (void*)dst.ptr(i), dst.cols, buffer) < 0)
+ if(CV_INSTRUMENT_FUN_IPP(ippsSortRadix_I, (void*)dst.ptr(i), dst.cols, buffer.data()) < 0)
return false;
}
}
dstSub = Mat(dst, subRect);
srcSub.copyTo(row);
- if(CV_INSTRUMENT_FUN_IPP(ippsSortRadix_I, (void*)row.ptr(), dst.rows, buffer) < 0)
+ if(CV_INSTRUMENT_FUN_IPP(ippsSortRadix_I, (void*)row.ptr(), dst.rows, buffer.data()) < 0)
return false;
row = row.reshape(1, dstSub.rows);
buf.allocate(len);
ibuf.allocate(len);
}
- T* bptr = (T*)buf;
- int* _iptr = (int*)ibuf;
+ T* bptr = buf.data();
+ int* _iptr = ibuf.data();
for( int i = 0; i < n; i++ )
{
for(int i = 0; i < src.rows; i++)
{
- if(CV_INSTRUMENT_FUN_IPP(ippsSortRadixIndex, (const void*)src.ptr(i), (Ipp32s)src.step[1], (Ipp32s*)dst.ptr(i), src.cols, buffer) < 0)
+ if(CV_INSTRUMENT_FUN_IPP(ippsSortRadixIndex, (const void*)src.ptr(i), (Ipp32s)src.step[1], (Ipp32s*)dst.ptr(i), src.cols, buffer.data()) < 0)
return false;
}
}
subRect.x = i;
dstSub = Mat(dst, subRect);
- if(CV_INSTRUMENT_FUN_IPP(ippsSortRadixIndex, (const void*)src.ptr(0, i), srcStep, (Ipp32s*)dstRow.ptr(), src.rows, buffer) < 0)
+ if(CV_INSTRUMENT_FUN_IPP(ippsSortRadixIndex, (const void*)src.ptr(0, i), srcStep, (Ipp32s*)dstRow.ptr(), src.rows, buffer.data()) < 0)
return false;
dstRow = dstRow.reshape(1, dstSub.rows);
intSumBlockSize = depth <= CV_8S ? (1 << 23) : (1 << 15);
blockSize = std::min(blockSize, intSumBlockSize);
_buf.allocate(cn);
- buf = _buf;
+ buf = _buf.data();
for( k = 0; k < cn; k++ )
buf[k] = 0;
int total = (int)it.size, blockSize = total, intSumBlockSize = 0;
int j, count = 0, nz0 = 0;
AutoBuffer<double> _buf(cn*4);
- double *s = (double*)_buf, *sq = s + cn;
+ double *s = (double*)_buf.data(), *sq = s + cn;
int *sbuf = (int*)s, *sqbuf = (int*)sq;
bool blockSum = depth <= CV_16S, blockSqSum = depth <= CV_8S;
size_t esz = 0;
size_t esz = dst.elemSize(), esz1 = dst.elemSize1();
size_t blocksize0 = (int)((BLOCK_SIZE + esz-1)/esz);
AutoBuffer<uchar> _buf((cn+1)*(sizeof(Mat*) + sizeof(uchar*)) + 16);
- const Mat** arrays = (const Mat**)(uchar*)_buf;
+ const Mat** arrays = (const Mat**)_buf.data();
uchar** ptrs = (uchar**)alignPtr(arrays + cn + 1, 16);
arrays[0] = &dst;
if (fileSourceSignatureSize == sourceSignatureSize_)
{
cv::AutoBuffer<char> fileSourceSignature(fileSourceSignatureSize + 1);
- f.read((char*)fileSourceSignature, fileSourceSignatureSize);
+ f.read(fileSourceSignature.data(), fileSourceSignatureSize);
if (f.eof())
{
CV_LOG_ERROR(NULL, "Unexpected EOF");
}
- else if (memcmp(sourceSignature, (const char*)fileSourceSignature, fileSourceSignatureSize) == 0)
+ else if (memcmp(sourceSignature, fileSourceSignature.data(), fileSourceSignatureSize) == 0)
{
isValid = true;
}
{
if (entry.keySize > 0)
{
- f.read((char*)fileKey, entry.keySize);
+ f.read(fileKey.data(), entry.keySize);
CV_Assert(!f.fail());
}
- if (memcmp((const char*)fileKey, key.c_str(), entry.keySize) == 0)
+ if (memcmp(fileKey.data(), key.c_str(), entry.keySize) == 0)
{
buf.resize(entry.dataSize);
f.read(&buf[0], entry.dataSize);
{
if (entry.keySize > 0)
{
- f.read((char*)fileKey, entry.keySize);
+ f.read(fileKey.data(), entry.keySize);
CV_Assert(!f.fail());
}
- if (0 == memcmp((const char*)fileKey, key.c_str(), entry.keySize))
+ if (0 == memcmp(fileKey.data(), key.c_str(), entry.keySize))
{
// duplicate
CV_LOG_VERBOSE(NULL, 0, "Duplicate key ignored: " << fileName_);
if (required > 0)
{
AutoBuffer<char> buf(required + 1);
- char* ptr = (char*)buf; // cleanup is not needed
+ char* ptr = buf.data(); // cleanup is not needed
err = f(obj, name, required, ptr, NULL);
if (err != CL_SUCCESS)
return err;
CV_OCL_DBG_CHECK(clGetDeviceIDs(pl, dtype, 0, 0, &nd0));
AutoBuffer<void*> dlistbuf(nd0*2+1);
- cl_device_id* dlist = (cl_device_id*)(void**)dlistbuf;
+ cl_device_id* dlist = (cl_device_id*)dlistbuf.data();
cl_device_id* dlist_new = dlist + nd0;
CV_OCL_DBG_CHECK(clGetDeviceIDs(pl, dtype, nd0, dlist, &nd0));
String name0;
// get platform name string
AutoBuffer<char> buf(sz + 1);
- CV_OCL_CHECK(clGetPlatformInfo(id, CL_PLATFORM_NAME, sz, buf, 0));
+ CV_OCL_CHECK(clGetPlatformInfo(id, CL_PLATFORM_NAME, sz, buf.data(), 0));
// just in case, ensure trailing zero for ASCIIZ string
buf[sz] = 0;
- name = (const char*)buf;
+ name = buf.data();
}
/*
{
buffer.resize(retsz + 16);
log_retval = clGetProgramBuildInfo(handle, deviceList[0],
- CL_PROGRAM_BUILD_LOG, retsz+1, (char*)buffer, &retsz);
+ CL_PROGRAM_BUILD_LOG, retsz+1, buffer.data(), &retsz);
if (log_retval == CL_SUCCESS)
{
if (retsz < buffer.size())
}
}
- errmsg = String(buffer);
+ errmsg = String(buffer.data());
printf("OpenCL program build log: %s/%s\nStatus %d: %s\n%s\n%s\n",
sourceModule_.c_str(), sourceName_.c_str(),
result, getOpenCLErrorString(result),
{
size_t n = ctx.ndevices();
AutoBuffer<cl_device_id, 4> deviceListBuf(n + 1);
- cl_device_id* deviceList = deviceListBuf;
+ cl_device_id* deviceList = deviceListBuf.data();
for (size_t i = 0; i < n; i++)
{
deviceList[i] = (cl_device_id)(ctx.device(i).ptr());
AutoBuffer<const uchar*> binaryPtrs_(ndevices);
AutoBuffer<size_t> binarySizes_(ndevices);
- cl_device_id* devices = devices_;
- const uchar** binaryPtrs = binaryPtrs_;
- size_t* binarySizes = binarySizes_;
+ cl_device_id* devices = devices_.data();
+ const uchar** binaryPtrs = binaryPtrs_.data();
+ size_t* binarySizes = binarySizes_.data();
for (size_t i = 0; i < ndevices; i++)
{
devices[i] = (cl_device_id)ctx.device(i).ptr();
}
cl_int result = 0;
- handle = clCreateProgramWithBinary((cl_context)ctx.ptr(), (cl_uint)ndevices, (cl_device_id*)devices_,
+ handle = clCreateProgramWithBinary((cl_context)ctx.ptr(), (cl_uint)ndevices, devices_.data(),
binarySizes, binaryPtrs, NULL, &result);
if (result != CL_SUCCESS)
{
}
// call clBuildProgram()
{
- result = clBuildProgram(handle, (cl_uint)ndevices, (cl_device_id*)devices_, buildflags.c_str(), 0, 0);
+ result = clBuildProgram(handle, (cl_uint)ndevices, devices_.data(), buildflags.c_str(), 0, 0);
CV_OCL_DBG_CHECK_RESULT(result, cv::format("clBuildProgram(binary: %s/%s)", sourceModule_.c_str(), sourceName_.c_str()).c_str());
if (result != CL_SUCCESS)
{
AutoBuffer<cl_image_format> formats(numFormats);
err = clGetSupportedImageFormats(context, CL_MEM_READ_WRITE,
CL_MEM_OBJECT_IMAGE2D, numFormats,
- formats, NULL);
+ formats.data(), NULL);
CV_OCL_DBG_CHECK_RESULT(err, "clGetSupportedImageFormats(CL_MEM_OBJECT_IMAGE2D, formats)");
for (cl_uint i = 0; i < numFormats; ++i)
{
if( ptr == ptr2 )
CV_Error( CV_StsBadArg, "Invalid filename" );
- char* name = name_buf;
+ char* name = name_buf.data();
// name must start with letter or '_'
if( !cv_isalpha(*ptr) && *ptr!= '_' ){
*name++ = c;
}
*name = '\0';
- name = name_buf;
+ name = name_buf.data();
if( strcmp( name, "_" ) == 0 )
strcpy( name, stubname );
return String(name);
if( disttype == UNIFORM )
{
_parambuf.allocate(cn*8 + n1 + n2);
- double* parambuf = _parambuf;
+ double* parambuf = _parambuf.data();
double* p1 = _param1.ptr<double>();
double* p2 = _param2.ptr<double>();
else if( disttype == CV_RAND_NORMAL )
{
_parambuf.allocate(MAX(n1, cn) + MAX(n2, cn));
- double* parambuf = _parambuf;
+ double* parambuf = _parambuf.data();
int ptype = depth == CV_64F ? CV_64F : CV_32F;
int esz = (int)CV_ELEM_SIZE(ptype);
if( disttype == UNIFORM )
{
buf.allocate(blockSize*cn*4);
- param = (uchar*)(double*)buf;
+ param = (uchar*)(double*)buf.data();
if( depth <= CV_32S )
{
else
{
buf.allocate((blockSize*cn+1)/2);
- nbuf = (float*)(double*)buf;
+ nbuf = (float*)(double*)buf.data();
}
for( size_t i = 0; i < it.nplanes; i++, ++it )
size_t esz = src.elemSize(), esz1 = src.elemSize1();
size_t blocksize0 = (BLOCK_SIZE + esz-1)/esz;
AutoBuffer<uchar> _buf((cn+1)*(sizeof(Mat*) + sizeof(uchar*)) + 16);
- const Mat** arrays = (const Mat**)(uchar*)_buf;
+ const Mat** arrays = (const Mat**)_buf.data();
uchar** ptrs = (uchar**)alignPtr(arrays + cn + 1, 16);
arrays[0] = &src;
intSumBlockSize = depth <= CV_8S ? (1 << 23) : (1 << 15);
blockSize = std::min(blockSize, intSumBlockSize);
_buf.allocate(cn);
- buf = _buf;
+ buf = _buf.data();
for( k = 0; k < cn; k++ )
buf[k] = 0;
va_list va;
va_start(va, fmt);
int bsize = static_cast<int>(buf.size());
- int len = cv_vsnprintf((char *)buf, bsize, fmt, va);
+ int len = cv_vsnprintf(buf.data(), bsize, fmt, va);
va_end(va);
CV_Assert(len >= 0 && "Check format string for errors");
continue;
}
buf[bsize - 1] = 0;
- return String((char *)buf, len);
+ return String(buf.data(), len);
}
}
rs[1] = _colRange;
for( int i = 2; i < m.dims; i++ )
rs[i] = Range::all();
- *this = m(rs);
+ *this = m(rs.data());
return;
}
UMat hdr = *this;
hdr.flags = (hdr.flags & ~CV_MAT_CN_MASK) | ((_cn-1) << CV_CN_SHIFT);
- setSize(hdr, _newndims, (int*)newsz_buf, NULL, true);
+ setSize(hdr, _newndims, newsz_buf.data(), NULL, true);
return hdr;
}
#else
DWORD sz = GetCurrentDirectoryA(0, NULL);
buf.allocate((size_t)sz);
- sz = GetCurrentDirectoryA((DWORD)buf.size(), (char*)buf);
- return cv::String((char*)buf, (size_t)sz);
+ sz = GetCurrentDirectoryA((DWORD)buf.size(), buf.data());
+ return cv::String(buf.data(), (size_t)sz);
#endif
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
for(;;)
{
- char* p = ::getcwd((char*)buf, buf.size());
+ char* p = ::getcwd(buf.data(), buf.size());
if (p == NULL)
{
if (errno == ERANGE)
}
break;
}
- return cv::String((char*)buf, (size_t)strlen((char*)buf));
+ return cv::String(buf.data(), (size_t)strlen(buf.data()));
#else
return cv::String();
#endif
int bufsz = 128; //enough for 14 doubles
AutoBuffer<uchar> buffer(bufsz);
size_t offset = 0;
- cv::Mat_<cv::Point2d> x(2, 3, (cv::Point2d*)(buffer+offset)); offset += x.total()*x.elemSize();
- double& param1 = *(double*)(buffer+offset); offset += sizeof(double);
- double& param2 = *(double*)(buffer+offset); offset += sizeof(double);
+ cv::Mat_<cv::Point2d> x(2, 3, (cv::Point2d*)(buffer.data()+offset)); offset += x.total()*x.elemSize();
+ double& param1 = *(double*)(buffer.data()+offset); offset += sizeof(double);
+ double& param2 = *(double*)(buffer.data()+offset); offset += sizeof(double);
param1 = -9; param2 = 2;
cv::theRNG().fill(x, cv::RNG::NORMAL, param1, param2);
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.
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;
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;
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
}
//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;
AutoBuffer<uchar> _buf((img.cols+16)*3*(sizeof(int) + sizeof(uchar)) + 128);
uchar* buf[3];
- buf[0] = _buf; buf[1] = buf[0] + img.cols; buf[2] = buf[1] + img.cols;
+ buf[0] = _buf.data(); buf[1] = buf[0] + img.cols; buf[2] = buf[1] + img.cols;
int* cpbuf[3];
cpbuf[0] = (int*)alignPtr(buf[2] + img.cols, sizeof(int)) + 1;
cpbuf[1] = cpbuf[0] + img.cols + 1;
float scale_sq_sq = scale * scale * scale * scale;
AutoBuffer<int> ofsbuf(blockSize*blockSize);
- int* ofs = ofsbuf;
+ int* ofs = ofsbuf.data();
for( int i = 0; i < blockSize; i++ )
for( int j = 0; j < blockSize; j++ )
ofs[i*blockSize + j] = (int)(i*step + j);
}
cv::AutoBuffer<int> centers_idx_buf(branching);
- int* centers_idx = (int*)centers_idx_buf;
+ int* centers_idx = centers_idx_buf.data();
int centers_length;
(this->*chooseCenters)(branching, indices, indices_length, centers_idx, centers_length);
cv::AutoBuffer<double> dcenters_buf(branching*veclen_);
- Matrix<double> dcenters((double*)dcenters_buf,branching,veclen_);
+ Matrix<double> dcenters(dcenters_buf.data(), branching, veclen_);
for (int i=0; i<centers_length; ++i) {
ElementType* vec = dataset_[centers_idx[i]];
for (size_t k=0; k<veclen_; ++k) {
std::vector<DistanceType> radiuses(branching);
cv::AutoBuffer<int> count_buf(branching);
- int* count = (int*)count_buf;
+ int* count = count_buf.data();
for (int i=0; i<branching; ++i) {
radiuses[i] = 0;
count[i] = 0;
// assign points to clusters
cv::AutoBuffer<int> belongs_to_buf(indices_length);
- int* belongs_to = (int*)belongs_to_buf;
+ int* belongs_to = belongs_to_buf.data();
for (int i=0; i<indices_length; ++i) {
DistanceType sq_dist = distance_(dataset_[indices[i]], dcenters[0], veclen_);
}
_bgr.allocate(m_width*3 + 32);
}
- uchar *src = _src, *bgr = _bgr;
+ uchar *src = _src.data(), *bgr = _bgr.data();
CV_TRY
{
if( !justcopy )
{
copy_buffer.allocate(sizeof(float) * m_width * 3);
- buffer = copy_buffer;
+ buffer = copy_buffer.data();
ystep = 0;
}
else
if( channels > 1 )
_buffer.allocate(width*channels);
- buffer = _buffer;
+ buffer = _buffer.data();
for( int y = 0; y < height; y++ )
{
/* setting buffer to max data size so scaling up is possible */
AutoBuffer<uchar> _src(src_elems_per_row * 2);
- uchar* src = _src;
- AutoBuffer<uchar> _gray_palette;
- uchar* gray_palette = _gray_palette;
+ uchar* src = _src.data();
if( m_offset < 0 || !m_strm.isOpened())
return false;
if (bit_mode) {
if( target_channels == 1 )
{
- _gray_palette.allocate(2);
- gray_palette = _gray_palette;
- gray_palette[0] = 0;
- gray_palette[1] = 255;
+ uchar gray_palette[2] = {0, 255};
for( y = 0; y < m_height; y++, data += imp_stride )
{
m_strm.getBytes( src, src_stride );
bufsize = tmp;
AutoBuffer<char> _buffer(bufsize);
- char* buffer = _buffer;
+ char* buffer = _buffer.data();
/* write header */
tmp = 0;
{
volatile bool result = false;
AutoBuffer<uchar*> _buffer(m_height);
- uchar** buffer = _buffer;
+ uchar** buffer = _buffer.data();
int color = img.channels() > 1;
png_structp png_ptr = (png_structp)m_png_ptr;
for( y = 0; y < height; y++ )
buffer[y] = img.data + y*img.step;
- png_write_image( png_ptr, buffer );
+ png_write_image( png_ptr, buffer.data() );
png_write_end( png_ptr, info_ptr );
result = true;
if( !m_binary )
{
AutoBuffer<uchar> _src(m_width);
- uchar* src = _src;
+ uchar* src = _src.data();
for (int y = 0; y < m_height; y++, data += img.step)
{
else
{
AutoBuffer<uchar> _src(src_pitch);
- uchar* src = _src;
+ uchar* src = _src.data();
for (int y = 0; y < m_height; y++, data += img.step)
{
case 24:
{
AutoBuffer<uchar> _src(std::max<size_t>(width3*2, src_pitch));
- uchar* src = _src;
+ uchar* src = _src.data();
for (int y = 0; y < m_height; y++, data += img.step)
{
bufferSize = lineLength;
AutoBuffer<char> _buffer(bufferSize);
- char* buffer = _buffer;
+ char* buffer = _buffer.data();
// write header;
const int code = ((mode == PXM_TYPE_PBM) ? 1 : (mode == PXM_TYPE_PGM) ? 2 : 3)
return false;
AutoBuffer<uchar> _src(src_pitch + 32);
- uchar* src = _src;
+ uchar* src = _src.data();
if( !color && m_maptype == RMT_EQUAL_RGB )
CvtPaletteToGray( m_palette, gray_palette, 1 << m_bpp );
}
const size_t buffer_size = (bpp/bitsPerByte) * ncn * tile_height0 * tile_width0;
AutoBuffer<uchar> _buffer( buffer_size );
- uchar* buffer = _buffer;
+ uchar* buffer = _buffer.data();
ushort* buffer16 = (ushort*)buffer;
float* buffer32 = (float*)buffer;
double* buffer64 = (double*)buffer;
// row buffer, because TIFFWriteScanline modifies the original data!
size_t scanlineSize = TIFFScanlineSize(pTiffHandle);
AutoBuffer<uchar> _buffer(scanlineSize + 32);
- uchar* buffer = _buffer;
+ uchar* buffer = _buffer.data();
if (!buffer)
{
TIFFClose(pTiffHandle);
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;
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
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;
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, "" );
{
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 )
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, "" );
{
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
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;
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;
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());
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
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;
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++ )
{
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));
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;
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++ )
{
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++ )
{
/* allocate buffers */
_buffer.allocate(buffer_size);
- state->buffer = buffer = _buffer;
+ state->buffer = buffer = _buffer.data();
buffer_end = buffer + buffer_size;
state->idx1 = (int*) buffer;
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.
}
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;
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++ )
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,
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;
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)));
{
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 )
{
}
AutoBuffer<float> wr(count*2);
- float *w = wr, *r = w + count;
+ float *w = wr.data(), *r = w + count;
for( k = 0; k < 20; k++ )
{
}
AutoBuffer<float> buf(count*2);
- float *w = buf, *r = w + count;
+ float *w = buf.data(), *r = w + count;
for( k = 0; k < 20; k++ )
{
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++)
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;
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;
{
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;
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
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;
{
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;
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;
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++ )
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;
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 "
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);
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 );
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 )
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;
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 };
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 );
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)
{
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++ )
void CV_FitLineTest::run_func()
{
if(!test_cpp)
- cvFitLine( points, dist_type, 0, reps, aeps, line );
+ cvFitLine( points, dist_type, 0, reps, aeps, line.data());
else if(dims == 2)
cv::fitLine(cv::cvarrToMat(points), (cv::Vec4f&)line[0], dist_type, 0, reps, aeps);
else
}
cv::AutoBuffer<double> _buf(buf_sz+noutputs);
- double* buf = _buf;
+ double* buf = _buf.data();
if( !_outputs.needed() )
{
_idx[i] = i;
AutoBuffer<double> _buf(max_lsize*2);
- double* buf[] = { _buf, (double*)_buf + max_lsize };
+ double* buf[] = { _buf.data(), _buf.data() + max_lsize };
const double* sw = _sw.empty() ? 0 : _sw.ptr<double>();
int nvars = (int)varIdx.size();
double sumw = 0., C = 1.;
cv::AutoBuffer<double> buf(n + nvars);
- double* result = buf;
+ double* result = buf.data();
float* sbuf = (float*)(result + n);
Mat sample(1, nvars, CV_32F, sbuf);
int predictFlags = bparams.boostType == Boost::DISCRETE ? (PREDICT_MAX_VOTE | RAW_OUTPUT) : PREDICT_SUM;
CatMapHash ofshash;
AutoBuffer<uchar> buf(nsamples);
- Mat non_missing(layout == ROW_SAMPLE ? Size(1, nsamples) : Size(nsamples, 1), CV_8U, (uchar*)buf);
+ Mat non_missing(layout == ROW_SAMPLE ? Size(1, nsamples) : Size(nsamples, 1), CV_8U, buf.data());
bool haveMissing = !missing.empty();
if( haveMissing )
{
CV_Assert(K > 0 && (normType == NORM_L2 || normType == NORM_L1));
AutoBuffer<uchar> _buf((K+1)*(sizeof(float) + sizeof(int)));
- int* idx = (int*)(uchar*)_buf;
+ int* idx = (int*)_buf.data();
float* dist = (float*)(idx + K + 1);
int i, j, ncount = 0, e = 0;
int qsize = 0, maxqsize = 1 << 10;
AutoBuffer<uchar> _pqueue(maxqsize*sizeof(PQueueElem));
- PQueueElem* pqueue = (PQueueElem*)(uchar*)_pqueue;
+ PQueueElem* pqueue = (PQueueElem*)_pqueue.data();
emax = std::max(emax, 1);
for( e = 0; e < emax; )
std::vector<int> idx;
AutoBuffer<int> _stack(MAX_TREE_DEPTH*2 + 1);
- int* stack = _stack;
+ int* stack = _stack.data();
int top = 0;
stack[top++] = 0;
int k = std::min(k0, nsamples);
AutoBuffer<float> buf(testcount*k*2);
- float* dbuf = buf;
+ float* dbuf = buf.data();
float* rbuf = dbuf + testcount*k;
const float* rptr = responses.ptr<float>();
}
// allocate memory and initializing headers for calculating
cv::AutoBuffer<double> _buffer(nvars*2);
- double* _diffin = _buffer;
- double* _diffout = _buffer + nvars;
+ double* _diffin = _buffer.data();
+ double* _diffout = _buffer.data() + nvars;
Mat diffin( 1, nvars, CV_64FC1, _diffin );
Mat diffout( 1, nvars, CV_64FC1, _diffout );
return;
AutoBuffer<double> vbuf(var_count);
- double* v = vbuf;
+ double* v = vbuf.data();
Mat new_sv(df_count, var_count, CV_32F);
vector<DecisionFunc> new_df;
int class_count = !svm->class_labels.empty() ? (int)svm->class_labels.total() : svmType == ONE_CLASS ? 1 : 0;
AutoBuffer<float> _buffer(sv_total + (class_count+1)*2);
- float* buffer = _buffer;
+ float* buffer = _buffer.data();
int i, j, dfi, k, si;
int splitidx = -1;
int vi_, nv = (int)activeVars.size();
AutoBuffer<int> buf(w->maxSubsetSize*2);
- int *subset = buf, *best_subset = subset + w->maxSubsetSize;
+ int *subset = buf.data(), *best_subset = subset + w->maxSubsetSize;
WSplit split, best_split;
best_split.quality = 0.;
// misclassified samples with cv_labels(*)==j.
// compute the number of instances of each class
- double* cls_count = buf;
+ double* cls_count = buf.data();
double* cv_cls_count = cls_count + m;
double max_val = -1, total_weight = 0;
}
else
{
- double *cv_sum = buf, *cv_sum2 = cv_sum + cv_n;
+ double *cv_sum = buf.data(), *cv_sum2 = cv_sum + cv_n;
double* cv_count = (double*)(cv_sum2 + cv_n);
for( j = 0; j < cv_n; j++ )
const int* sidx = &_sidx[0];
const int* responses = &w->cat_responses[0];
const double* weights = &w->sample_weights[0];
- double* lcw = (double*)(uchar*)buf;
+ double* lcw = (double*)buf.data();
double* rcw = lcw + m;
float* values = (float*)(rcw + m);
int* sorted_idx = (int*)(values + n);
int iters = 0, max_iters = 100;
int i, j, idx;
cv::AutoBuffer<double> buf(n + k);
- double *v_weights = buf, *c_weights = buf + n;
+ double *v_weights = buf.data(), *c_weights = buf.data() + n;
bool modified = true;
RNG r((uint64)-1);
base_size += mi;
AutoBuffer<double> buf(base_size + n);
- double* lc = (double*)buf;
+ double* lc = buf.data();
double* rc = lc + m;
double* _cjk = rc + m*2, *cjk = _cjk;
double* c_weights = cjk + m*mi;
- int* labels = (int*)(buf + base_size);
+ int* labels = (int*)(buf.data() + base_size);
w->data->getNormCatValues(vi, _sidx, labels);
const int* responses = &w->cat_responses[0];
const double* weights = &w->sample_weights[0];
AutoBuffer<uchar> buf(n*(sizeof(int) + sizeof(float)));
- float* values = (float*)(uchar*)buf;
+ float* values = (float*)buf.data();
int* sorted_idx = (int*)(values + n);
w->data->getValues(vi, _sidx, values);
const double* responses = &w->ord_responses[0];
int mi = getCatCount(vi);
AutoBuffer<double> buf(3*mi + 3 + n);
- double* sum = (double*)buf + 1;
+ double* sum = buf.data() + 1;
double* counts = sum + mi + 1;
double** sum_ptr = (double**)(counts + mi);
int* cat_labels = (int*)(sum_ptr + mi);
if( mi <= 0 ) // split on an ordered variable
{
float c = split.c;
- float* values = buf;
+ float* values = buf.data();
w->data->getValues(vi, _sidx, values);
for( i = 0; i < n; i++ )
else
{
const int* subset = &w->wsubsets[split.subsetOfs];
- int* cat_labels = (int*)(float*)buf;
+ int* cat_labels = (int*)buf.data();
w->data->getNormCatValues(vi, _sidx, cat_labels);
for( i = 0; i < n; i++ )
int i, ncats = (int)catOfs.size(), nclasses = (int)classLabels.size();
int catbufsize = ncats > 0 ? nvars : 0;
AutoBuffer<int> buf(nclasses + catbufsize + 1);
- int* votes = buf;
+ int* votes = buf.data();
int* catbuf = votes + nclasses;
const int* cvidx = (flags & (COMPRESSED_INPUT|PREPROCESSED_INPUT)) == 0 && !varIdx.empty() ? &compVarIdx[0] : 0;
const uchar* vtype = &varType[0];
size_t i, nscales = scales.size();
cv::AutoBuffer<int> stripeSizeBuf(nscales);
- int* stripeSizes = stripeSizeBuf;
+ int* stripeSizes = stripeSizeBuf.data();
const FeatureEvaluator::ScaleData* s = &featureEvaluator->getScaleData(0);
Size szw = s->getWorkingSize(data.origWinSize);
int nstripes = cvCeil(szw.width/32.);
#endif
AutoBuffer<int> mapbuf(gradsize.width + gradsize.height + 4);
- int* xmap = (int*)mapbuf + 1;
+ int* xmap = mapbuf.data() + 1;
int* ymap = xmap + gradsize.width + 2;
const int borderType = (int)BORDER_REFLECT_101;
// x- & y- derivatives for the whole row
int width = gradsize.width;
AutoBuffer<float> _dbuf(width*4);
- float* const dbuf = _dbuf;
+ float* const dbuf = _dbuf.data();
Mat Dx(1, width, CV_32F, dbuf);
Mat Dy(1, width, CV_32F, dbuf + width);
Mat Mag(1, width, CV_32F, dbuf + width*2);
{
AutoBuffer<float> di(blockSize.height), dj(blockSize.width);
- float* _di = (float*)di, *_dj = (float*)dj;
+ float* _di = di.data(), *_dj = dj.data();
float bh = blockSize.height * 0.5f, bw = blockSize.width * 0.5f;
i = 0;
_lut(0,i) = (float)i;
AutoBuffer<int> mapbuf(gradsize.width + gradsize.height + 4);
- int* xmap = (int*)mapbuf + 1;
+ int* xmap = mapbuf.data() + 1;
int* ymap = xmap + gradsize.width + 2;
const int borderType = (int)BORDER_REFLECT_101;
// x- & y- derivatives for the whole row
int width = gradsize.width;
AutoBuffer<float> _dbuf(width*4);
- float* dbuf = _dbuf;
+ float* dbuf = _dbuf.data();
Mat Dx(1, width, CV_32F, dbuf);
Mat Dy(1, width, CV_32F, dbuf + width);
Mat Mag(1, width, CV_32F, dbuf + width*2);
_sizes[i] = sizes[i];
if( cn > 1 )
_sizes[dims++] = cn;
- PyObject* o = PyArray_SimpleNew(dims, _sizes, typenum);
+ PyObject* o = PyArray_SimpleNew(dims, _sizes.data(), typenum);
if(!o)
CV_Error_(Error::StsError, ("The numpy array of typenum=%d, ndims=%d can not be created", typenum, dims));
return allocate(o, dims0, sizes, type, step);
for (int i = 0; i < desc.rows; ++i)
idxs[i] = i;
- std::sort((int*)idxs, (int*)idxs + desc.rows, KeypointComparator(pts));
+ std::sort(idxs.data(), idxs.data() + desc.rows, KeypointComparator(pts));
std::vector<cv::KeyPoint> spts(pts.size());
cv::Mat sdesc(desc.size(), desc.type());
for( int y = y0; y < y1; y++ )
{
- const float* data = buf;
+ const float* data = buf.data();
if( src->depth() != CV_32F )
src->row(y).convertTo(Mat(1, ncols, CV_32FC(nchannels), (void*)data), CV_32F);
else
int x, y, delta = (int)alignSize((cols + 2)*cn, 16);
AutoBuffer<deriv_type> _tempBuf(delta*2 + 64);
- deriv_type *trow0 = alignPtr(_tempBuf + cn, 16), *trow1 = alignPtr(trow0 + delta, 16);
+ deriv_type *trow0 = alignPtr(_tempBuf.data() + cn, 16), *trow1 = alignPtr(trow0 + delta, 16);
#if CV_SIMD128
v_int16x8 c3 = v_setall_s16(3), c10 = v_setall_s16(10);
cv::AutoBuffer<deriv_type> _buf(winSize.area()*(cn + cn2));
int derivDepth = DataType<deriv_type>::depth;
- Mat IWinBuf(winSize, CV_MAKETYPE(derivDepth, cn), (deriv_type*)_buf);
- Mat derivIWinBuf(winSize, CV_MAKETYPE(derivDepth, cn2), (deriv_type*)_buf + winSize.area()*cn);
+ Mat IWinBuf(winSize, CV_MAKETYPE(derivDepth, cn), _buf.data());
+ Mat derivIWinBuf(winSize, CV_MAKETYPE(derivDepth, cn2), _buf.data() + winSize.area()*cn);
for( int ptidx = range.start; ptidx < range.end; ptidx++ )
{
int width = src.cols;
int height = src.rows;
AutoBuffer<float> kbuf(n*6 + 3), _row((width + n*2)*3);
- float* g = kbuf + n;
+ float* g = kbuf.data() + n;
float* xg = g + n*2 + 1;
float* xxg = xg + n*2 + 1;
- float *row = (float*)_row + n*3;
+ float *row = _row.data() + n*3;
double ig11, ig03, ig33, ig55;
FarnebackPrepareGaussian(n, sigma, g, xg, xxg, ig11, ig03, ig33, ig55);
double scale = 1./(block_size*block_size);
AutoBuffer<double> _vsum((width+m*2+2)*5);
- double* vsum = _vsum + (m+1)*5;
+ double* vsum = _vsum.data() + (m+1)*5;
// init vsum
const float* srow0 = matM.ptr<float>();
AutoBuffer<float> _vsum((width+m*2+2)*5 + 16), _hsum(width*5 + 16);
AutoBuffer<float> _kernel((m+1)*5 + 16);
- AutoBuffer<float*> _srow(m*2+1);
- float *vsum = alignPtr((float*)_vsum + (m+1)*5, 16), *hsum = alignPtr((float*)_hsum, 16);
- float* kernel = (float*)_kernel;
- const float** srow = (const float**)&_srow[0];
+ AutoBuffer<const float*> _srow(m*2+1);
+ float *vsum = alignPtr(_vsum.data() + (m+1)*5, 16), *hsum = alignPtr(_hsum.data(), 16);
+ float* kernel = _kernel.data();
+ const float** srow = _srow.data();
kernel[0] = (float)s;
for( i = 1; i <= m; i++ )
for(int i = 0; i < count; ++i)
{
mfxFrameSurface1 &surface = surfaces[i];
- uint8_t * dataPtr = buffers + oneSize * i;
+ uint8_t * dataPtr = buffers.data() + oneSize * i;
memset(&surface, 0, sizeof(mfxFrameSurface1));
surface.Info = frameInfo;
surface.Data.Y = dataPtr;
srAttr->SetUnknown(MF_SOURCE_READER_D3D_MANAGER, D3DMgr.Get());
#endif
cv::AutoBuffer<wchar_t> unicodeFileName(_filename.length() + 1);
- MultiByteToWideChar(CP_ACP, 0, _filename.c_str(), -1, unicodeFileName, (int)_filename.length() + 1);
- if (SUCCEEDED(MFCreateSourceReaderFromURL(unicodeFileName, srAttr.Get(), &videoFileSource)))
+ MultiByteToWideChar(CP_ACP, 0, _filename.c_str(), -1, unicodeFileName.data(), (int)_filename.length() + 1);
+ if (SUCCEEDED(MFCreateSourceReaderFromURL(unicodeFileName.data(), srAttr.Get(), &videoFileSource)))
{
isOpen = true;
sampleTime = 0;
{
// Create the sink writer
cv::AutoBuffer<wchar_t> unicodeFileName(filename.length() + 1);
- MultiByteToWideChar(CP_ACP, 0, filename.c_str(), -1, unicodeFileName, (int)filename.length() + 1);
- HRESULT hr = MFCreateSinkWriterFromURL(unicodeFileName, NULL, spAttr.Get(), &sinkWriter);
+ MultiByteToWideChar(CP_ACP, 0, filename.c_str(), -1, unicodeFileName.data(), (int)filename.length() + 1);
+ HRESULT hr = MFCreateSinkWriterFromURL(unicodeFileName.data(), NULL, spAttr.Get(), &sinkWriter);
if (SUCCEEDED(hr))
{
// Configure the sink writer and tell it start to start accepting data