mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 13:10:12 +08:00
replaced alloca() (a.k.a. cvStackAlloc) with AutoBuffer or vector() everywhere. cvStackAlloc() is still defined, but we do not need alloca() anymore to compile and run OpenCV (fixes #889 and may be some others)
This commit is contained in:
parent
0e81d9a11c
commit
c5e3869c32
@ -483,7 +483,7 @@ icvComputeK( CvStereoGCState* state )
|
||||
int x, y, x1, d, i, j, rows = state->left->rows, cols = state->left->cols, n = 0;
|
||||
int mind = state->minDisparity, nd = state->numberOfDisparities, maxd = mind + nd;
|
||||
int k = MIN(MAX((nd + 2)/4, 3), nd), delta, t, sum = 0;
|
||||
vector<int> _arr(k);
|
||||
std::vector<int> _arr(k+1);
|
||||
int *arr = &_arr[0];
|
||||
|
||||
for( y = 0; y < rows; y++ )
|
||||
@ -902,7 +902,7 @@ CV_IMPL void cvFindStereoCorrespondenceGC( const CvArr* _left, const CvArr* _rig
|
||||
icvInitStereoConstTabs();
|
||||
icvInitGraySubpix( left, right, state->left, state->right );
|
||||
|
||||
vector<int> disp(state->numberOfDisparities);
|
||||
std::vector<int> disp(state->numberOfDisparities);
|
||||
CvMat _disp = cvMat( 1, (int)disp.size(), CV_32S, &disp[0] );
|
||||
cvRange( &_disp, state->minDisparity, state->minDisparity + state->numberOfDisparities );
|
||||
cvRandShuffle( &_disp, &rng );
|
||||
|
@ -3619,7 +3619,6 @@ icvReadSparseMat( CvFileStorage* fs, CvFileNode* node )
|
||||
CvFileNode* sizes_node;
|
||||
CvSeqReader reader;
|
||||
CvSeq* elements;
|
||||
int* idx;
|
||||
int sizes[CV_MAX_DIM_HEAP], dims, elem_type, cn;
|
||||
int i;
|
||||
|
||||
@ -3645,7 +3644,7 @@ icvReadSparseMat( CvFileStorage* fs, CvFileNode* node )
|
||||
mat = cvCreateSparseMat( dims, sizes, elem_type );
|
||||
|
||||
cn = CV_MAT_CN(elem_type);
|
||||
idx = (int*)alloca( dims*sizeof(idx[0]) );
|
||||
int idx[CV_MAX_DIM_HEAP];
|
||||
elements = data->data.seq;
|
||||
cvStartReadRawData( fs, data, &reader );
|
||||
|
||||
|
@ -646,7 +646,8 @@ float CvRTrees::predict( const CvMat* sample, const CvMat* missing ) const
|
||||
if( nclasses > 0 ) //classification
|
||||
{
|
||||
int max_nvotes = 0;
|
||||
int* votes = (int*)alloca( sizeof(int)*nclasses );
|
||||
cv::AutoBuffer<int> _votes(nclasses);
|
||||
int* votes = _votes;
|
||||
memset( votes, 0, sizeof(*votes)*nclasses );
|
||||
for( k = 0; k < ntrees; k++ )
|
||||
{
|
||||
@ -682,7 +683,8 @@ float CvRTrees::predict_prob( const CvMat* sample, const CvMat* missing) const
|
||||
if( nclasses == 2 ) //classification
|
||||
{
|
||||
int max_nvotes = 0;
|
||||
int* votes = (int*)alloca( sizeof(int)*nclasses );
|
||||
cv::AutoBuffer<int> _votes(nclasses);
|
||||
int* votes = _votes;
|
||||
memset( votes, 0, sizeof(*votes)*nclasses );
|
||||
for( k = 0; k < ntrees; k++ )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user