/* * NAME: ujfs_validate_super * * FUNCTION: Check if superblock is valid * * PRE CONDITIONS: * * POST CONDITIONS: * * PARAMETERS: * sb - superblock to validate * * NOTES: * * RECOVERY OPERATION: * * DATA STRUCTURES: * * RETURNS: * success: 0 * failure: LIBFS_CORRUPTSUPER, LIBFS_BADVERSION, LIBFS_BADMAGIC */ int32 ujfs_validate_super( struct superblock *sb ) { if( memcmp(sb->s_magic, JFS_MAGIC, sizeof(sb->s_magic)) == 0 ) { if( sb->s_version != JFS_VERSION ) return LIBFS_BADVERSION; if( validate_sizes(sb) == EINVAL ) return LIBFS_CORRUPTSUPER; } else { return LIBFS_BADMAGIC; } return 0; }
// Args: // depth - the HxW depth image (read in column major order). // intensity - the HxW intensity image (read in column major order). // noise_mask - the HxW logical noise mask. Values of 1 indicate that the // corresponding depth value is missing or noisy. // sigma_s - Sx1 vector of sigmas. // sigma_r - Sx1 vector of range sigmas. void mexFunction(int nlhs, mxArray* plhs[], const int nrhs, const mxArray* prhs[]) { if (nrhs != 5) { mexErrMsgTxt("Usage: mex_cbf(depth, intensity, noise, sigmaS, sigmaR);"); } validate_types(prhs); validate_sizes(prhs); uint8_t* depth = (uint8_t*) mxGetData(prhs[ARG_DEPTH]); uint8_t* intensity = (uint8_t*) mxGetData(prhs[ARG_INTENSITY]); bool* noise_mask = (bool*) mxGetData(prhs[ARG_NOISE]); double* sigma_s = (double*) mxGetData(prhs[ARG_SIG_S]); double* sigma_r = (double*) mxGetData(prhs[ARG_SIG_R]); mwSize ndim = 2; mwSize dims[] = {IMG_HEIGHT, IMG_WIDTH}; plhs[0] = mxCreateNumericArray(ndim, &dims[0], mxUINT8_CLASS, mxREAL); uint8_t* result = (uint8_t*) mxGetData(plhs[0]); cbf::cbf(depth, intensity, noise_mask, result, sigma_s, sigma_r); }