Changeset 3302
- Timestamp:
- Feb 22, 2005, 10:06:24 AM (21 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 2 edited
-
image/psImageStats.c (modified) (2 diffs)
-
imageops/psImageStats.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImageStats.c
r3264 r3302 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.6 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-02- 17 19:26:24 $11 * @version $Revision: 1.67 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-02-22 20:06:24 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 57 57 } 58 58 59 // stuff the image data into a psVector struct. 60 junkData = (psVector *) psAlloc(sizeof(psVector)); 61 junkData->type = in->type; 62 junkData->nalloc = in->numRows * in->numCols; 63 junkData->n = junkData->nalloc; 64 junkData->data.V = in->data.V[0]; // since psImage data is contiguous... 59 if (in->parent == NULL) { 60 // stuff the image data into a psVector struct. 61 junkData = (psVector *) psAlloc(sizeof(psVector)); 62 junkData->type = in->type; 63 junkData->nalloc = in->numRows * in->numCols; 64 junkData->n = junkData->nalloc; 65 junkData->data.V = in->data.V[0]; // since psImage data is contiguous... 66 } else { 67 // image not necessarily contiguous 68 int numRows = in->numRows; 69 int numCols = in->numCols; 70 int rowSize = numCols * (PSELEMTYPE_SIZEOF(in->type.type)); 71 72 junkData = psVectorAlloc(numRows*numCols, in->type.type); 73 junkData->n = junkData->nalloc; 74 75 psU8* data = junkData->data.V; 76 for (int row = 0; row < numRows; row++) { 77 memcpy(data, in->data.V[row], rowSize); 78 data += rowSize; 79 } 80 } 65 81 66 82 if (mask != NULL) { 67 // stuff the mask data into a psVector struct. 68 junkMask = psAlloc(sizeof(psVector)); 69 junkMask->type = mask->type; 70 junkMask->nalloc = mask->numRows * mask->numCols; 71 junkMask->n = junkMask->nalloc; 72 junkMask->data.V = mask->data.V[0]; 83 if (mask->parent == NULL) { 84 // stuff the mask data into a psVector struct. 85 junkMask = psAlloc(sizeof(psVector)); 86 junkMask->type = mask->type; 87 junkMask->nalloc = mask->numRows * mask->numCols; 88 junkMask->n = junkMask->nalloc; 89 junkMask->data.V = mask->data.V[0]; 90 } else { 91 // image not necessarily contiguous 92 int numRows = mask->numRows; 93 int numCols = mask->numCols; 94 int rowSize = numCols * (PSELEMTYPE_SIZEOF(mask->type.type)); 95 96 junkMask = psVectorAlloc(numRows*numCols, mask->type.type); 97 junkMask->n = junkMask->nalloc; 98 99 psU8* data = junkMask->data.V; 100 for (int row = 0; row < numRows; row++) { 101 memcpy(data, mask->data.V[row], rowSize); 102 data += rowSize; 103 } 104 } 73 105 } 74 106 -
trunk/psLib/src/imageops/psImageStats.c
r3264 r3302 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.6 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-02- 17 19:26:24 $11 * @version $Revision: 1.67 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-02-22 20:06:24 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 57 57 } 58 58 59 // stuff the image data into a psVector struct. 60 junkData = (psVector *) psAlloc(sizeof(psVector)); 61 junkData->type = in->type; 62 junkData->nalloc = in->numRows * in->numCols; 63 junkData->n = junkData->nalloc; 64 junkData->data.V = in->data.V[0]; // since psImage data is contiguous... 59 if (in->parent == NULL) { 60 // stuff the image data into a psVector struct. 61 junkData = (psVector *) psAlloc(sizeof(psVector)); 62 junkData->type = in->type; 63 junkData->nalloc = in->numRows * in->numCols; 64 junkData->n = junkData->nalloc; 65 junkData->data.V = in->data.V[0]; // since psImage data is contiguous... 66 } else { 67 // image not necessarily contiguous 68 int numRows = in->numRows; 69 int numCols = in->numCols; 70 int rowSize = numCols * (PSELEMTYPE_SIZEOF(in->type.type)); 71 72 junkData = psVectorAlloc(numRows*numCols, in->type.type); 73 junkData->n = junkData->nalloc; 74 75 psU8* data = junkData->data.V; 76 for (int row = 0; row < numRows; row++) { 77 memcpy(data, in->data.V[row], rowSize); 78 data += rowSize; 79 } 80 } 65 81 66 82 if (mask != NULL) { 67 // stuff the mask data into a psVector struct. 68 junkMask = psAlloc(sizeof(psVector)); 69 junkMask->type = mask->type; 70 junkMask->nalloc = mask->numRows * mask->numCols; 71 junkMask->n = junkMask->nalloc; 72 junkMask->data.V = mask->data.V[0]; 83 if (mask->parent == NULL) { 84 // stuff the mask data into a psVector struct. 85 junkMask = psAlloc(sizeof(psVector)); 86 junkMask->type = mask->type; 87 junkMask->nalloc = mask->numRows * mask->numCols; 88 junkMask->n = junkMask->nalloc; 89 junkMask->data.V = mask->data.V[0]; 90 } else { 91 // image not necessarily contiguous 92 int numRows = mask->numRows; 93 int numCols = mask->numCols; 94 int rowSize = numCols * (PSELEMTYPE_SIZEOF(mask->type.type)); 95 96 junkMask = psVectorAlloc(numRows*numCols, mask->type.type); 97 junkMask->n = junkMask->nalloc; 98 99 psU8* data = junkMask->data.V; 100 for (int row = 0; row < numRows; row++) { 101 memcpy(data, mask->data.V[row], rowSize); 102 data += rowSize; 103 } 104 } 73 105 } 74 106
Note:
See TracChangeset
for help on using the changeset viewer.
