Changeset 23989 for trunk/psLib/src/imageops/psImageGeomManip.c
- Timestamp:
- Apr 28, 2009, 11:21:56 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImageGeomManip.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageGeomManip.c
r21183 r23989 110 110 out = psImageRecycle(out, outCols, outRows, in->type.type); 111 111 112 #define PS_IMAGE_REBIN_CASE(TYPE)\113 case PS_TYPE_##TYPE: {\114 ps##TYPE *outRowData; \115 ps##TYPE *vecData = vec->data.TYPE; \116 psImageMaskType *inRowMask = NULL; \117 for (psS32 row = 0; row < outRows; row++) { \118 outRowData = out->data.TYPE[row]; \119 psS32 inCurrentRow = row * scale; \120 psS32 inNextRow = (row + 1) * scale; \121 for (psS32 col = 0; col < outCols; col++) { \122 psS32 inCurrentCol = col * scale; \123 psS32 inNextCol = (col + 1) * scale; \124 psS32 n = 0; \112 #define PS_IMAGE_REBIN_CASE(TYPE) \ 113 case PS_TYPE_##TYPE: { \ 114 ps##TYPE *outRowData; \ 115 ps##TYPE *vecData = vec->data.TYPE; \ 116 psImageMaskType *inRowMask = NULL; \ 117 for (psS32 row = 0; row < outRows; row++) { \ 118 outRowData = out->data.TYPE[row]; \ 119 psS32 inCurrentRow = row * scale; \ 120 psS32 inNextRow = (row + 1) * scale; \ 121 for (psS32 col = 0; col < outCols; col++) { \ 122 psS32 inCurrentCol = col * scale; \ 123 psS32 inNextCol = (col + 1) * scale; \ 124 psS32 n = 0; \ 125 125 for (psS32 inRow = inCurrentRow; inRow < inNextRow && inRow < inRows; inRow++) { \ 126 ps##TYPE* inRowData = in->data.TYPE[inRow]; \127 if (mask != NULL) { \126 ps##TYPE* inRowData = in->data.TYPE[inRow]; \ 127 if (mask != NULL) { \ 128 128 inRowMask = mask->data.PS_TYPE_IMAGE_MASK_DATA[inRow]; \ 129 } \129 } \ 130 130 for (psS32 inCol = inCurrentCol; inCol < inNextCol && inCol < inCols; inCol++) { \ 131 if (maskData != NULL) { \131 if (maskData != NULL) { \ 132 132 maskData[n] = (inRowMask[inCol] & maskVal); \ 133 } \ 134 vecData[n++] = inRowData[inCol]; \ 135 } \ 136 } \ 137 vec->n = n; \ 138 if (maskVec) { \ 139 maskVec->n = n; \ 140 } \ 141 psVectorStats(myStats, vec, NULL, maskVec, 0xff); /* the mask vector has only 0 or 1 */ \ 142 outRowData[col] = (ps##TYPE)psStatsGetValue(myStats, statistic); \ 143 } \ 144 } \ 145 } \ 133 } \ 134 vecData[n++] = inRowData[inCol]; \ 135 } \ 136 } \ 137 vec->n = n; \ 138 if (maskVec) { \ 139 maskVec->n = n; \ 140 } \ 141 if (!psVectorStats(myStats, vec, NULL, maskVec, 0xff)) { /* the mask vector has only 0 or 1 */ \ 142 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); \ 143 psFree(out); \ 144 out = NULL; \ 145 goto escape; \ 146 } \ 147 outRowData[col] = (ps##TYPE)psStatsGetValue(myStats, statistic); \ 148 } \ 149 } \ 150 } \ 146 151 break; 147 152 … … 161 166 char* typeStr; 162 167 PS_TYPE_NAME(typeStr,in->type.type); 163 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 164 _("Specified psImage type, %s, is not supported."), 165 typeStr); 168 psError(PS_ERR_BAD_PARAMETER_TYPE, true, _("Specified psImage type, %s, is not supported."), typeStr); 166 169 psFree(out); 167 170 out = NULL; … … 169 172 } 170 173 174 escape: 171 175 psFree(vec); 172 176 psFree(maskVec);
Note:
See TracChangeset
for help on using the changeset viewer.
