Changeset 4558 for trunk/psLib/test/imageops/tst_psImageGeomManip.c
- Timestamp:
- Jul 14, 2005, 4:40:20 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/imageops/tst_psImageGeomManip.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/imageops/tst_psImageGeomManip.c
r4547 r4558 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-07-1 3 02:47:00 $8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-07-15 02:40:20 $ 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);1088 1087 for (psS32 row=0;row<rows;row++) { 1089 1088 psF32* inRow = in->data.F32[row]; 1090 psMaskType* maskRow = mask->data.PS_TYPE_MASK_DATA[row];1091 1089 for (psS32 col=0;col<cols;col++) { 1092 1090 inRow[col] = (psF32)row+(psF32)col/1000.0f; 1093 maskRow[col] = 0; 1094 } 1095 } 1096 1097 1098 // ********** check psImageTransform with minimum specified inputs. 1091 } 1092 } 1099 1093 1100 1094 psImage* out = psImageTransform(NULL, … … 1144 1138 } 1145 1139 1146 // zero out buffer1147 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 mask1153 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 1200 1140 psFree(out); 1201 1141 psFree(in);
Note:
See TracChangeset
for help on using the changeset viewer.
