Commit 407a0045 authored by Dongwoon Hyun's avatar Dongwoon Hyun

Fixed OpenMP and variable stack allocation errors.

parent 421b27d8
......@@ -36,7 +36,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
// INPUT 2: KERNEL SIZE
// Default value for kernel size is 1 in all pixel dimensions
size_t kernsz[npdims];
size_t kernsz[MAX_NPDIM];
for (size_t i = 0; i < npdims; i++) { kernsz[i] = 1; }
// If user provides kernel sizes, use them
if (nrhs >= 2) {
......@@ -99,7 +99,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
}
// OUTPUT 1: Real correlation coefficients
mwSize outdims[ndims];
mwSize outdims[MAX_NPDIM+1];
for (int i = 0; i < ndims-1; i++)
outdims[i] = dims[i];
outdims[ndims-1] = nlags;
......
......@@ -188,7 +188,7 @@ void computeCoherence(int ccmode,
#ifdef ENABLE_MULTITHREADING // silence compiler warning
#pragma omp parallel for
#endif
for (size_t p = 0; p < npixels; p++) {
for (int p = 0; p < npixels; p++) {
ptrdiff_t pixIdx[MAX_NPDIM];
getArrayIndexes(p, npdims, dataDims, pixIdx);
......@@ -389,7 +389,7 @@ static void getArrayIndexes(size_t overallIdx, size_t ndims, const size_t *dims,
}
else {
// Get frame size of sub-tensor
int subSize = 1; for (size_t i = 0; i < ndims - 1; i++) { subSize *= dims[i]; }
int subSize = 1; for (size_t i = 0; i < ndims - 1; i++) { subSize *= (int)dims[i]; }
idx[ndims-1] = int(overallIdx) / subSize;
getArrayIndexes(overallIdx % subSize, ndims-1, dims, idx);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment