Changeset 4541 for trunk/psLib/test/image/tst_psImageGeomManip.c
- Timestamp:
- Jul 12, 2005, 9:27:28 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/image/tst_psImageGeomManip.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImageGeomManip.c
r4308 r4541 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-0 6-17 23:44:22$8 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-07-12 19:27:28 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1085 1085 1086 1086 psImage* in = psImageAlloc(cols,rows,PS_TYPE_F32); 1087 psImage* mask = psImageAlloc(cols,rows,PS_TYPE_MASK); 1087 1088 for (psS32 row=0;row<rows;row++) { 1088 1089 psF32* inRow = in->data.F32[row]; 1090 psMaskType* maskRow = mask->data.PS_TYPE_MASK_DATA[row]; 1089 1091 for (psS32 col=0;col<cols;col++) { 1090 1092 inRow[col] = (psF32)row+(psF32)col/1000.0f; 1091 } 1092 } 1093 maskRow[col] = 0; 1094 } 1095 } 1096 1097 1098 // ********** check psImageTransform with minimum specified inputs. 1093 1099 1094 1100 psImage* out = psImageTransform(NULL, … … 1138 1144 } 1139 1145 1146 // zero out buffer 1147 memset(out->rawDataBuffer, 0, sizeof(psF32)*out->numRows*out->numCols); 1148 1149 psPixels* blanks = psPixelsAlloc(10); 1150 psPixels* mask = psPixelsAlloc(10); 1151 1152 // perform the same transform, but this time, supply a psImage to recycle and a mask 1153 out = psImageTransform(out, 1154 blanks, 1155 in, 1156 mask, 1157 1, 1158 trans, 1159 psRegionSet(0,0,0,0), 1160 NULL, 1161 PS_INTERPOLATE_FLAT, 1162 -1); 1163 1164 if (out == NULL) { 1165 psError(PS_ERR_UNKNOWN, false, 1166 "out == NULL"); 1167 return 1; 1168 } 1169 if (out->type.type != PS_TYPE_F32) { 1170 psError(PS_ERR_UNKNOWN, false, 1171 "out->type.type != PS_TYPE_F32, out->type.type == %d", 1172 out->type.type); 1173 return 2; 1174 } 1175 if (out->numRows != rows*2 || out->numCols != cols*2) { 1176 psError(PS_ERR_UNKNOWN, false, 1177 "out size is %dx%d, not %dx%d", 1178 out->numCols, out->numRows, cols*2, rows); 1179 return 3; 1180 } 1181 1182 for (psS32 row=0;row<out->numRows;row++) { 1183 psF32* outRow = out->data.F32[row]; 1184 for (psS32 col=0;col<cols;col++) { 1185 float inValue = p_psImagePixelInterpolateFLAT_F32(in, 1186 col*trans->x->coeff[1][0]+trans->x->coeff[0][0], 1187 row*trans->y->coeff[0][1]+trans->y->coeff[0][0], 1188 NULL, 0, 1189 -1); 1190 if (fabsf(outRow[col] - inValue) > FLT_EPSILON*10) { 1191 psError(PS_ERR_UNKNOWN, false, 1192 "out at %d,%d was %g, expected %g", 1193 col,row,outRow[col], inValue); 1194 return 4; 1195 } 1196 } 1197 } 1198 1199 1140 1200 psFree(out); 1141 1201 psFree(in);
Note:
See TracChangeset
for help on using the changeset viewer.
